|
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 |
attock Smarty Rookie
Joined: 13 Jul 2008 Posts: 13
|
Posted: Sun Mar 17, 2013 3:25 pm Post subject: Assigning closuer as variables in smarty gives syntax error |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon Mar 18, 2013 1:29 pm Post subject: |
|
|
Smarty does not yet support variables as closures syntax. |
|
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
|