closeTag example

/** * Compiles code for the {/block} tag * * @param array $args array with attributes from parser * @param object $compiler compiler object * @return string compiled code */
    public function compile($args$compiler) {
        $compiler->has_code = true;
        // check and get attributes         $_attr = $this->getAttributes($compiler$args);
        $saved_data = $this->closeTag($compiler, array('block'));
        $_name = trim($saved_data[0]['name'], "\"'");
        if (isset($compiler->template->block_data[$_name]) && !isset($compiler->template->block_data[$_name]['compiled'])) {
            // restore to status before {block} tag as new subtemplate code of parent {block} is not needed             // TODO: Below code was disabled in 3.1.8 because of problems with {include} in nested {block} tags in child templates             // combined with append/prepend or $smarty.block.parent             // For later versions it should be checked under which conditions it could run for optimisation             //             //$compiler->merged_templates = $saved_data[4];             //$compiler->smarty->merged_templates_func = $saved_data[5];             //$compiler->template->properties = $saved_data[6];             //$compiler->template->has_nocache_code = $saved_data[7];
$this->traverser->children($ele->childNodes);
            }

            // Close out the SVG or MathML special handling.             if ('svg' == $name || 'math' == $name) {
                $this->outputMode = static::IM_IN_HTML;
            }
        }

        // If not unary, add a closing tag.         if (!Elements::isA($name, Elements::VOID_TAG)) {
            $this->closeTag($ele);
        }
    }

    /** * Write a text node. * * @param \DOMText $ele The text node to write. */
    public function text($ele)
    {
        if (isset($ele->parentNode) && isset($ele->parentNode->tagName) && Elements::isA($ele->parentNode->localName, Elements::TEXT_RAW)) {
            

    public function compile($args$compiler$parameter)
    {
        // check and get attributes         $_attr  = $this->getAttributes($compiler$args);

        list($openTag$nocache) = $this->closeTag($compiler, array('for'));
        $this->openTag($compiler, 'forelse', array('forelse', $nocache));
        return "<?php }} else { ?>";
    }

}

/** * Smarty Internal Plugin Compile Forclose Class * * @package Smarty * @subpackage Compiler */
/** * Compiles code for the {else} tag * * @param array $args array with attributes from parser * @param object $compiler compiler object * @param array $parameter array with compilation parameter * @return string compiled code */
    public function compile($args$compiler$parameter)
    {
        list($nesting$compiler->tag_nocache) = $this->closeTag($compiler, array('if', 'elseif'));
        $this->openTag($compiler, 'else', array($nesting$compiler->tag_nocache));

        return "<?php }else{ ?>";
    }

}

/** * Smarty Internal Plugin Compile ElseIf Class * * @package Smarty * @subpackage Compiler */
$output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; echo \$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]->{$function[1]}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>";
            } else {
                $output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; echo {$function[0]}::{$function[1]}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>";
            }
        } else {
            // must endblock be nocache?             if ($compiler->nocache) {
                $compiler->tag_nocache = true;
            }
            $base_tag = substr($tag, 0, -5);
            // closing tag of block plugin, restore nocache             list($_params$compiler->nocache) = $this->closeTag($compiler$base_tag);
            // This tag does create output             $compiler->has_output = true;
               if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$base_tag])) {
                   $function = $compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$base_tag][0];
               } else {
                   $function = $compiler->default_handler_plugins[Smarty::PLUGIN_BLOCK][$base_tag][0];
               }
            // compile code             if (!isset($parameter['modifier_list'])) {
                $mod_pre = $mod_post ='';
            } else {
                

    public function compile($args$compiler)
    {
        // check and get attributes         $_attr = $this->getAttributes($compiler$args);

        list($openTag$nocache) = $this->closeTag($compiler, array('section'));
        $this->openTag($compiler, 'sectionelse', array('sectionelse', $nocache));

        return "<?php endfor; else: ?>";
    }

}

/** * Smarty Internal Plugin Compile Sectionclose Class * * @package Smarty * @subpackage Compiler */
$this->openTag($compiler$tag, array($_params$compiler->nocache));
            // maybe nocache because of nocache variables or nocache plugin             $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
            // compile code             $output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; echo {$function}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>";
        } else {
            // must endblock be nocache?             if ($compiler->nocache) {
                $compiler->tag_nocache = true;
            }
            // closing tag of block plugin, restore nocache             list($_params$compiler->nocache) = $this->closeTag($compilersubstr($tag, 0, -5));
            // This tag does create output             $compiler->has_output = true;
            // compile code             if (!isset($parameter['modifier_list'])) {
                $mod_pre = $mod_post ='';
            } else {
                $mod_pre = ' ob_start(); ';
                $mod_post = 'echo '.$compiler->compileTag('private_modifier',array(),array('modifierlist'=>$parameter['modifier_list'],'value'=>'ob_get_clean()')).';';
            }
            $output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false;".$mod_pre." echo {$function}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat); ".$mod_post." } array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
        }
        

    public function compile($args$compiler)
    {
        // must endblock be nocache?         if ($compiler->nocache) {
            $compiler->tag_nocache = true;
        }
        $compiler->nocache = $this->closeTag($compiler, array('while'));
        return "<?php }?>";
    }

}

?>
/** * Compiles code for the {/function} tag * * @param array $args array with attributes from parser * @param object $compiler compiler object * @param array $parameter array with compilation parameter * @return boolean true */
    public function compile($args$compiler$parameter)
    {
        $_attr = $this->getAttributes($compiler$args);
        $saved_data = $this->closeTag($compiler, array('function'));
        $_name = trim($saved_data[0]['name'], "'\"");
        // build plugin include code         $plugins_string = '';
        if (!empty($compiler->template->required_plugins['compiled'])) {
            $plugins_string = '<?php ';
            foreach($compiler->template->required_plugins['compiled'] as $tmp) {
                foreach($tmp as $data) {
                    $plugins_string .= "if (!is_callable('{$data['function']}')) include '{$data['file']}';\n";
                }
            }
            $plugins_string .= '?>';
        }
// maybe nocache because of nocache variables or nocache plugin             $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
            // compile code             $output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}->{$method}', {$_params}); \$_block_repeat=true; echo \$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>";
        } else {
            $base_tag = substr($tag, 0, -5);
            // must endblock be nocache?             if ($compiler->nocache) {
                $compiler->tag_nocache = true;
            }
            // closing tag of block plugin, restore nocache             list($_params$compiler->nocache) = $this->closeTag($compiler$base_tag . '->' . $method);
            // This tag does create output             $compiler->has_output = true;
            // compile code             if (!isset($parameter['modifier_list'])) {
                $mod_pre = $mod_post = '';
            } else {
                $mod_pre = ' ob_start(); ';
                $mod_post = 'echo ' . $compiler->compileTag('private_modifier', array(), array('modifierlist' => $parameter['modifier_list'], 'value' => 'ob_get_clean()')) . ';';
            }
            $output = "<?php \$_block_content = ob_get_contents(); ob_end_clean(); \$_block_repeat=false;" . $mod_pre . " echo \$_smarty_tpl->smarty->registered_objects['{$base_tag}'][0]->{$method}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat); " . $mod_post . " } array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
        }
        

    public function compile($args$compiler$parameter)
    {
        // check and get attributes         $_attr = $this->getAttributes($compiler$args);

        list($openTag$nocache$item$key) = $this->closeTag($compiler, array('foreach'));
        $this->openTag($compiler, 'foreachelse', array('foreachelse', $nocache$item$key));

        return "<?php }\nif (!\$_smarty_tpl->tpl_vars[$item]->_loop) {\n?>";
    }

}

/** * Smarty Internal Plugin Compile Foreachclose Class * * @package Smarty * @subpackage Compiler */
Home | Imprint | This part of the site doesn't use cookies.