3 * Smarty Internal Plugin Nocache Insert
4 * Compiles the {insert} tag into the cache file
12 * Smarty Internal Plugin Compile Insert Class
15 * @subpackage Compiler
17 class Smarty_Internal_Nocache_Insert
20 * Compiles code for the {insert} tag into cache file
22 * @param string $_function insert function name
23 * @param array $_attr array with parameter
24 * @param Smarty_Internal_Template $_template template object
25 * @param string $_script script name to load or 'null'
26 * @param string $_assign optional variable name
28 * @return string compiled code
30 public static function compile($_function, $_attr, $_template, $_script, $_assign = null)
33 if ($_script != 'null') {
34 // script which must be included
35 // code for script file loading
36 $_output .= "require_once '{$_script}';";
39 if (isset($_assign)) {
40 $_output .= "\$_smarty_tpl->assign('{$_assign}' , {$_function} (" . var_export($_attr, true) .
41 ",\$_smarty_tpl), true);?>";
43 $_output .= "echo {$_function}(" . var_export($_attr, true) . ",\$_smarty_tpl);?>";
46 while ($_tpl->_isSubTpl()) {
47 $_tpl = $_tpl->parent;
50 return "/*%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/" . $_output .
51 "/*/%%SmartyNocache:{$_tpl->compiled->nocache_hash}%%*/";