Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Smarty 3.1.12: const compile failure

 
Post new topic   Reply to topic    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
Lillilotte
Smarty Rookie


Joined: 09 Jan 2013
Posts: 8

PostPosted: Wed Jan 09, 2013 10:49 pm    Post subject: Smarty 3.1.12: const compile failure Reply with quote

If I tried something like
Code:

<?php
define('bar', 'foobar');
$smarty->assign('foo', 'bar');
?>

foobar.tpl:
{$smarty.const.$foo}
or
{$smarty.const.{$foo}}

I would expect an output like
Code:

foobar

but I get
Code:

bar


The reason is the compilation of the smarty compiler. That generates the following from the above:
Code:

<?php echo @$_smarty_tpl->tpl_vars['foo']->value;?>
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Wed Jan 09, 2013 11:38 pm    Post subject: Reply with quote

We did originally not support variable constants.

But it was easy it implement. This enhancement is now in the SVN trunk and will later be included in 3.1.13.
Back to top
View user's profile Send private message
Lillilotte
Smarty Rookie


Joined: 09 Jan 2013
Posts: 8

PostPosted: Thu Jan 10, 2013 7:53 pm    Post subject: Reply with quote

Super! Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Bugs 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