3 * Smarty Internal Plugin Compile Shared Inheritance
4 * Shared methods for {extends} and {block} tags
12 * Smarty Internal Plugin Compile Shared Inheritance Class
15 * @subpackage Compiler
17 class Smarty_Internal_Compile_Shared_Inheritance extends Smarty_Internal_CompileBase
20 * Register post compile callback to compile inheritance initialization code
22 * @param \Smarty_Internal_TemplateCompilerBase $compiler
23 * @param bool|false $initChildSequence if true force child template
25 public function registerInit(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false)
27 if ($initChildSequence || !isset($compiler->_cache[ 'inheritanceInit' ])) {
28 $compiler->registerPostCompileCallback(array('Smarty_Internal_Compile_Shared_Inheritance', 'postCompile'),
29 array($initChildSequence), 'inheritanceInit', $initChildSequence);
31 $compiler->_cache[ 'inheritanceInit' ] = true;
36 * Compile inheritance initialization code as prefix
38 * @param \Smarty_Internal_TemplateCompilerBase $compiler
39 * @param bool|false $initChildSequence if true force child template
41 static function postCompile(Smarty_Internal_TemplateCompilerBase $compiler, $initChildSequence = false)
43 $compiler->prefixCompiledCode .= "<?php \$_smarty_tpl->_loadInheritance();\n\$_smarty_tpl->inheritance->init(\$_smarty_tpl, " .
44 var_export($initChildSequence, true) . ");\n?>\n";