|
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 |
enska Smarty n00b
Joined: 07 Oct 2003 Posts: 2
|
Posted: Tue Oct 07, 2003 10:35 pm Post subject: How to pass variable to function inside template? |
|
|
How can I pass parameters to PHP functions inside template?
[php:1:376c042d68]
<td>{php}my_func( $param1, $param2, $param3 );{/php}</td>
[/php:1:376c042d68] |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Wed Oct 08, 2003 11:09 pm Post subject: |
|
|
the docs for {php} say "This is for advanced users only, not normally needed."
so my first awswer would be: if you have to ask, don't use it. ( {php} is bad, it makes your templates as ugly as php-script mixing html and php and smarty looses it's value fully with {php}-cluttered templates).
my second answer: use $this->get_template_vars('paramX') to get values of template-vars or obtain references to them. |
|
Back to top |
|
enska Smarty n00b
Joined: 07 Oct 2003 Posts: 2
|
Posted: Thu Oct 09, 2003 8:58 pm Post subject: |
|
|
I've dymanic menu tree where I check if user has right access level to display menu item. Trying to figure another way to do that. |
|
Back to top |
|
Troublegum Smarty Rookie
Joined: 07 Sep 2003 Posts: 33 Location: Germany
|
Posted: Fri Oct 10, 2003 10:19 am Post subject: |
|
|
Check the permissions in your php-script and assign a boolean value 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
|