Forums / General / Own php script!

Own php script!

Author Message

Kaiko Kaur

Monday 12 May 2003 9:59:28 pm

I tried to include my own php file to eZ publish. I used followed howto:
http://ez.no/developer/ez_publish_3/documentation/ez_publish_3/howtos/how_can_i_use_my_own_php_script_inside_ezp

But I can not use this variable inside template. As I can understand I should be able to use all php variables inside my template?! But I can't. After reading this I tried {$GLOBALS|attribute(show,1)}, but guess... nothing.
Can somebody help me? Best help is explaining why eZ publish i acting like this!?

Bård Farstad

Wednesday 28 May 2003 2:20:04 am

To get access to a variable inside the template you need to set it first.

You can set template variables with the function setVariable(). A dirty example:

$tpl->setVariable( 'globals', $GLOBALS );

This will set the template variable globals, {$globals}, to the value of all global PHP variables.

However I would not recommend using the GLOBALS direcly, you should use the functions in eZHTTPTool to fetch variables. E.g. postVariable() should be used to fetch HTTP post variables.

--bård

Documentation: http://ez.no/doc