4  * Smarty Internal Plugin Nocache Insert
 
   6  * Compiles the {insert} tag into the cache file
 
  14  * Smarty Internal Plugin Compile Insert Class
 
  16 class Smarty_Internal_Nocache_Insert {
 
  18      * Compiles code for the {insert} tag into cache file
 
  20      * @param string $_function insert function name
 
  21      * @param array $_attr array with paramter
 
  22      * @param object $template template object
 
  23      * @param string $_script script name to load or 'null'
 
  24      * @param string $_assign soptinal variable name
 
  25      * @return string compiled code
 
  27     static function compile($_function, $_attr, $_template, $_script, $_assign = null)
 
  30         if ($_script != 'null') {
 
  31             // script which must be included
 
  32             // code for script file loading
 
  33             $_output .= "require_once '{$_script}';";
 
  36         if (isset($_assign)) {
 
  37             $_output .= "\$_smarty_tpl->assign('{$_assign}' , {$_function} (" . var_export($_attr, true) . ",\$_smarty_tpl), true);?>";
 
  39             $_output .= "echo {$_function}(" . var_export($_attr, true) . ",\$_smarty_tpl);?>";
 
  42         while ($_tpl->parent instanceof Smarty_Internal_Template) {
 
  43             $_tpl = $_tpl->parent;
 
  45         return "/*%%SmartyNocache:{$_tpl->properties['nocache_hash']}%%*/" . $_output . "/*/%%SmartyNocache:{$_tpl->properties['nocache_hash']}%%*/";