{assign_by_ref} or sth. similar in a template

View: New views
2 Messages — Rating Filter:   Alert me  

{assign_by_ref} or sth. similar in a template

by Benjamin Bolbach-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



 Hi folks,  

  sorry for the maybe misleading subject. My problem is, I want to
display a variable in a template, that's value  

 is assigned later in the template, e.g.  
 {$mytext}  

 {include file="test.tpl}  
 test.tpl contains anywhere  
 {assign var="mytext" value="sometexthere"}  
 but this does not work, with a test to add {$mytext} behind the
assignline, show, that the vriable only exists after the assignment.


 so the question is is there something like a assign_by_ref inside
the template, where the var is assigned before it gets filled with
the real content  

 and filled with the real content later?  
 thx  

  Ben  

Re: {assign_by_ref} or sth. similar in a template

by Iv Ray :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Ben,

To my knowledge you can't do that. Smarty is executed in a linear manner
(same as php - I do not think your example would work in php either).

I think I imagine your problem - you would like to display something
let's say at the top of the page, but you do not have access to it until
later. I guess, if this is the case, you will need some architectural
decision, which to provide you with this information at an earlier point.

All the best,
Iv

--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php