Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Callable {function..} defined in {include file=...}

 
Post new topic   Reply to topic    Smarty Forum Index -> Feature Requests
View previous topic :: View next topic  
Author Message
vorapoap
Smarty Rookie


Joined: 22 Dec 2009
Posts: 32

PostPosted: Fri Dec 10, 2010 10:40 am    Post subject: Callable {function..} defined in {include file=...} Reply with quote

Dear Developer,

I think this behavior changes in recent Smarty version via it is working in some previous beta version.

I used to be able to define {function .... scope=global} only once in the top area of .tpl file and it is callable anywhere in later .tpl (even if called under by {include file=} )

But now the behavior is changed? Could you make this possible again?.. So I don't need to include content from my global Smarty {function} file all over any templates again and again..

Regards,
Vorapoap L.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Fri Dec 10, 2010 12:34 pm    Post subject: Reply with quote

!. The {function } tag does not have a special scope parameter. What you did with {function .... scope=global} was jsut to assign the string 'global' to a variable with name 'scope'.

2. Once the {function} is declared it can beused also from subtemplates. But as subtemplates could be compiled independent from the main template you must use the {call...} tag to call the function from a subtemplate.

See the note here http://www.smarty.net/docs/en/language.function.function.tpl and here[url] http://www.smarty.net/docs/en/language.function.call.tpl[/url]
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Feature Requests 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