Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

How to pass variable to function inside template?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
enska
Smarty n00b


Joined: 07 Oct 2003
Posts: 2

PostPosted: Tue Oct 07, 2003 10:35 pm    Post subject: How to pass variable to function inside template? Reply with quote

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
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Wed Oct 08, 2003 11:09 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
enska
Smarty n00b


Joined: 07 Oct 2003
Posts: 2

PostPosted: Thu Oct 09, 2003 8:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
Troublegum
Smarty Rookie


Joined: 07 Sep 2003
Posts: 33
Location: Germany

PostPosted: Fri Oct 10, 2003 10:19 am    Post subject: Reply with quote

Check the permissions in your php-script and assign a boolean value to the template.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP