Forums / General / PHP function import problem

PHP function import problem

Author Message

Zak dma

Monday 20 March 2006 11:50:27 pm

I try to import PHP function rand() to generate random value.
Steps:
1. Create template ezpublish\settings\override\template.ini.append.php with content
<?php /* #?ini charset="utf-8"?
[PHP]
PHPOperatorList[rand]=rand
*/ ?>
2. In pagelayout.tpl
{rand(1, 10)}

Result: it does not work.
Could you please tell me what the problem is?

Ɓukasz Serwatka

Monday 20 March 2006 11:56:48 pm

Zak, PHPOperatorList requires only PHP function with one required argument like strip_tags(). random template operator will be available in version 3.8 (May). For now you can ues this contrib:

http://ez.no/community/contribs/template_plugins/randomnum_operator

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Zak dma

Tuesday 21 March 2006 12:17:37 am

Thanx!