How-to: php script inside tpl file?

Author Message

Alessandro Cipriani

Friday 27 February 2004 12:57:30 am

hi all
as you can read in http://ez.no/community/forum/setup_design/how_to_retrieve_session_id, i need to retrieve session id in my homepage.
with ezhttp i didn't be able to retrieve the id, so my question is the follow:

i think that i can insert some php script into the tpl page (<?php ... ?>). but how?
if i write
<?php
session_start();
$sid = session_id(); echo sid;
echo 'Hello world';
?>
either sid, either 'Hello world' aren't displayed! so i think is a php syntax error...

any hint?
best regards
alessandro
no output is displayed

Alex Jones

Friday 27 February 2004 6:15:28 am

Alessandro, I am afraid there is not an easy way to include PHP inside of a template. This was a choice that the eZ team specifically made. What you should do is build an operator that includes the PHP you need access to. Check out http://ez.no/ez_publish/documentation/development/kernel/custom_template_operators and perhaps search for 'operators' on the ez.no site for more information.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

Alessandro Cipriani

Friday 27 February 2004 6:37:21 am

thanx alex
i think that another way to solve my problem would be use ezhttp to retrieve the session id... isn't it possible?

best regards
alessandro

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.