|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
tuntun Smarty n00b
Joined: 24 Oct 2006 Posts: 1
|
Posted: Tue Oct 24, 2006 6:41 pm Post subject: retrieve the data in {php} |
|
|
I am tring to write a php function that's called from a smarty .tpl file.
there is a variable called $entry.id in smarty that I need to retrieve
from within {php} {/php} , how can i do it ? please let me know...
=========
my entry id is { $entry.id }
{php}
global $entry.id; // this doesn't work
my_function ( $myid, $another_variable );
{/php}
============ |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Tue Oct 24, 2006 6:46 pm Post subject: |
|
|
Code: | $entry = $this->get_template_vars('entry');
echo $entry['id'];
|
see: get_template_vars() in the manual.
Now that you know, don't. {php} in-template is bad form. Better to use a plugin or pre-calculate before sending data to the template. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|