Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Assigning closuer as variables in smarty gives syntax error

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


Joined: 13 Jul 2008
Posts: 13

PostPosted: Sun Mar 17, 2013 3:25 pm    Post subject: Assigning closuer as variables in smarty gives syntax error Reply with quote

Smarty version: 3.1.13

- php (5.3+)

$myVar = function() { return blah; }

$smarty->assign('myVar', $myVar)

- Template
{$myVar()}

- Result Fatal Error
Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "index.tpl.php" on line 2 "{$myVar()}"
- Unexpected "(", expected one of: "}" , " " , ATTR' in sysplugins/smarty_internal_templatecompilerbase.php:665

Stack trace:
#0 sysplugins/smarty_internal_templateparser.php(3144): Smarty_Internal_TemplateCompilerBase->trigger_template_error()
#1 sysplugins/smarty_internal_templateparser.php(3209): Smarty_Internal_Templateparser->yy_syntax_error(38, '(')
#2 sysplugins/smarty_internal_smartytemplatecompiler.php(105): Smarty_Internal_Templateparser->doParse(38, '(')
#3 sysplugins/smarty_internal_templatecompilerbase.php on line 665
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7269
Location: Lincoln Nebraska, USA

PostPosted: Mon Mar 18, 2013 1:29 pm    Post subject: Reply with quote

Smarty does not yet support variables as closures syntax.
Back to top
View user's profile Send private message Visit poster's website
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