X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/098a79f0819ebb89b7d48df4a6b154af4560f68e..9a23a8c0a51b7ec38a96f525484134f3cb85dc7e:/WEB-INF/lib/smarty/sysplugins/smarty_internal_compile_eval.php diff --git a/WEB-INF/lib/smarty/sysplugins/smarty_internal_compile_eval.php b/WEB-INF/lib/smarty/sysplugins/smarty_internal_compile_eval.php new file mode 100644 index 00000000..aa3c2580 --- /dev/null +++ b/WEB-INF/lib/smarty/sysplugins/smarty_internal_compile_eval.php @@ -0,0 +1,51 @@ +compiler = $compiler; + $this->required_attributes = array('var'); + $this->optional_attributes = array('assign'); + // check and get attributes + $_attr = $this->_get_attributes($args); + if (isset($_attr['assign'])) { + // output will be stored in a smarty variable instead of beind displayed + $_assign = $_attr['assign']; + } + + // create template object + $_output = "\$_template = new {$compiler->smarty->template_class}('eval:'.".$_attr['var'].", \$_smarty_tpl->smarty, \$_smarty_tpl);"; + //was there an assign attribute? + if (isset($_assign)) { + $_output .= "\$_smarty_tpl->assign($_assign,\$_template->getRenderedTemplate());"; + } else { + $_output .= "echo \$_template->getRenderedTemplate();"; + } + return ""; + } +} + +?> \ No newline at end of file