![Smarty Forum Index Smarty Forum Index](templates/smarty/images/phpbb2_logo.gif) |
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 |
shivgoa Smarty n00b
Joined: 02 Dec 2012 Posts: 1
|
Posted: Sun Dec 02, 2012 10:20 am Post subject: Variable in variable value |
|
|
Suppose I have in php file
<?
$tpl->assign('_YEAR',date('Y'));
$tpl->assign('_FOOTER',"This is {$_YEAR}");
?>
and in templeate file
<div class="footer">{$_FOOTER}</div>
---
The current output is
<div class="footer">This is {$_YEAR}</div>
What do I do so that I get
<div class="footer">This is 2012</div>
----
P.S. Year is just an example. This can be any value coming from database.
Please help! |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sun Dec 02, 2012 1:29 pm Post subject: |
|
|
Smarty does not parse assigned variable values for template code.
If you really need it see {eval} http://www.smarty.net/docs/en/language.function.eval.tpl
But this has very bad performance as the compiler must be called for each such variable. |
|
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
|