本文整理汇总了PHP中Smarty_Internal_Compile_Block::compileChildBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP Smarty_Internal_Compile_Block::compileChildBlock方法的具体用法?PHP Smarty_Internal_Compile_Block::compileChildBlock怎么用?PHP Smarty_Internal_Compile_Block::compileChildBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Smarty_Internal_Compile_Block
的用法示例。
在下文中一共展示了Smarty_Internal_Compile_Block::compileChildBlock方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: compile
public function compile($args, $compiler)
{
$compiler->has_code = true;
$_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'])) {
$_output = Smarty_Internal_Compile_Block::compileChildBlock($compiler, $_name);
} else {
if (isset($saved_data[0]['hide']) && !isset($compiler->template->block_data[$_name]['source'])) {
$_output = '';
} else {
$_output = $compiler->parser->current_buffer->to_smarty_php();
}
unset($compiler->template->block_data[$_name]['compiled']);
}
$compiler->parser->current_buffer = $saved_data[1];
$compiler->nocache = $saved_data[2];
$compiler->smarty->merge_compiled_includes = $saved_data[3];
$compiler->inheritance = false;
$compiler->suppressNocacheProcessing = true;
return $_output;
}
开发者ID:EfncoPlugins,项目名称:web-portal-lite-client-portal-secure-file-sharing-private-messaging,代码行数:23,代码来源:smarty_internal_compile_block.php
示例2: compile
/**
* 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];
$_output = Smarty_Internal_Compile_Block::compileChildBlock($compiler, $_name);
} else {
if (isset($saved_data[0]['hide']) && !isset($compiler->template->block_data[$_name]['source'])) {
$_output = '';
} else {
$_output = $compiler->parser->current_buffer->to_smarty_php();
}
unset($compiler->template->block_data[$_name]['compiled']);
}
// reset flags
$compiler->parser->current_buffer = $saved_data[1];
$compiler->nocache = $saved_data[2];
$compiler->smarty->merge_compiled_includes = $saved_data[3];
// reset flag for {block} tag
$compiler->inheritance = false;
// $_output content has already nocache code processed
$compiler->suppressNocacheProcessing = true;
return $_output;
}
示例3: compile
/**
* 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'], "\"'");
// reset flag for {block} tag
$compiler->inheritance = $saved_data[1];
// check if we process an inheritance child template
if ($compiler->inheritance_child) {
$name1 = Smarty_Internal_Compile_Block::$nested_block_names[0];
Smarty_Internal_Compile_Block::$block_data[$name1]['source'] .= "{$compiler->smarty->left_delimiter}/private_child_block{$compiler->smarty->right_delimiter}";
$level = count(Smarty_Internal_Compile_Block::$nested_block_names);
array_shift(Smarty_Internal_Compile_Block::$nested_block_names);
if (!empty(Smarty_Internal_Compile_Block::$nested_block_names)) {
$name2 = Smarty_Internal_Compile_Block::$nested_block_names[0];
if (isset($compiler->template->block_data[$name1]) || !$saved_data[0]['hide']) {
if (isset(Smarty_Internal_Compile_Block::$block_data[$name1]['child']) || !isset($compiler->template->block_data[$name1])) {
Smarty_Internal_Compile_Block::$block_data[$name2]['source'] .= Smarty_Internal_Compile_Block::$block_data[$name1]['source'];
} else {
if ($compiler->template->block_data[$name1]['mode'] == 'append') {
Smarty_Internal_Compile_Block::$block_data[$name2]['source'] .= Smarty_Internal_Compile_Block::$block_data[$name1]['source'] . $compiler->template->block_data[$name1]['source'];
} elseif ($compiler->template->block_data[$name1]['mode'] == 'prepend') {
Smarty_Internal_Compile_Block::$block_data[$name2]['source'] .= $compiler->template->block_data[$name1]['source'] . Smarty_Internal_Compile_Block::$block_data[$name1]['source'];
} else {
Smarty_Internal_Compile_Block::$block_data[$name2]['source'] .= $compiler->template->block_data[$name1]['source'];
}
}
}
unset(Smarty_Internal_Compile_Block::$block_data[$name1]);
$compiler->lex->yypushstate(Smarty_Internal_Templatelexer::CHILDBLOCK);
} else {
if (isset($compiler->template->block_data[$name1]) || !$saved_data[0]['hide']) {
if (isset($compiler->template->block_data[$name1]) && !isset(Smarty_Internal_Compile_Block::$block_data[$name1]['child'])) {
if (strpos($compiler->template->block_data[$name1]['source'], Smarty_Internal_Compile_Block::parent) !== false) {
$compiler->template->block_data[$name1]['source'] =
str_replace(Smarty_Internal_Compile_Block::parent, Smarty_Internal_Compile_Block::$block_data[$name1]['source'], $compiler->template->block_data[$name1]['source']);
} elseif ($compiler->template->block_data[$name1]['mode'] == 'prepend') {
$compiler->template->block_data[$name1]['source'] .= Smarty_Internal_Compile_Block::$block_data[$name1]['source'];
} elseif ($compiler->template->block_data[$name1]['mode'] == 'append') {
$compiler->template->block_data[$name1]['source'] = Smarty_Internal_Compile_Block::$block_data[$name1]['source'] . $compiler->template->block_data[$name1]['source'];
}
} else {
$compiler->template->block_data[$name1]['source'] = Smarty_Internal_Compile_Block::$block_data[$name1]['source'];
}
$compiler->template->block_data[$name1]['mode'] = 'replace';
if ($saved_data[0]['append']) {
$compiler->template->block_data[$name1]['mode'] = 'append';
}
if ($saved_data[0]['prepend']) {
$compiler->template->block_data[$name1]['mode'] = 'prepend';
}
}
unset(Smarty_Internal_Compile_Block::$block_data[$name1]);
$compiler->lex->yypushstate(Smarty_Internal_Templatelexer::CHILDBODY);
}
$compiler->has_code = false;
return;
}
if (isset($compiler->template->block_data[$_name]) && !isset($compiler->template->block_data[$_name]['compiled'])) {
$_output = Smarty_Internal_Compile_Block::compileChildBlock($compiler, $_name);
} else {
if ($saved_data[0]['hide'] && !isset($compiler->template->block_data[$_name]['source'])) {
$_output = '';
} else {
$_output = $compiler->parser->current_buffer->to_smarty_php();
}
}
unset($compiler->template->block_data[$_name]['compiled']);
// reset flags
$compiler->parser->current_buffer = $saved_data[2];
if ($compiler->nocache) {
$compiler->tag_nocache = true;
}
$compiler->nocache = $saved_data[3];
// $_output content has already nocache code processed
$compiler->suppressNocacheProcessing = true;
return $_output;
}
示例4: compile
/**
* 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)
{
$this->compiler = $compiler;
$this->smarty = $compiler->smarty;
$this->compiler->has_code = true;
// check and get attributes
$_attr = $this->_get_attributes($args);
$saved_data = $this->_close_tag(array('block'));
$_name = trim($saved_data[0]['name'], "\"'");
if (isset($compiler->template->block_data[$_name]) && !isset($compiler->template->block_data[$_name]['compiled'])) {
$_output = Smarty_Internal_Compile_Block::compileChildBlock($compiler, $_name);
} else {
$_output = $compiler->parser->current_buffer->to_smarty_php();
unset($compiler->template->block_data[$_name]['compiled']);
}
// reset flags
$compiler->parser->current_buffer = $saved_data[1];
$compiler->nocache = $saved_data[2];
$compiler->smarty->merge_compiled_includes = $saved_data[3];
$compiler->smarty->inheritance = $saved_data[4];
// $_output content has already nocache code processed
$compiler->suppressNocacheProcessing = true;
return $_output;
}
示例5: compile
/**
* 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
$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];
$_output = Smarty_Internal_Compile_Block::compileChildBlock($compiler, $_name);
} else {
if (isset($saved_data[0]['hide']) && !isset($compiler->template->block_data[$_name]['source'])) {
$_output = '';
} else {
$_output = $compiler->parser->current_buffer->to_smarty_php();
}
unset($compiler->template->block_data[$_name]['compiled']);
}
// reset flags
$compiler->parser->current_buffer = $saved_data[1];
$compiler->nocache = $saved_data[2];
$compiler->smarty->merge_compiled_includes = $saved_data[3];
// reset flag for {block} tag
$compiler->inheritance = false;
// $_output content has already nocache code processed
$compiler->suppressNocacheProcessing = true;
return $_output;
}
示例6: yy_r50
function yy_r50()
{
$j = strrpos($this->yystack[$this->yyidx + 0]->minor, '.');
if ($this->yystack[$this->yyidx + 0]->minor[$j + 1] == 'c') {
// {$smarty.block.child}
$this->_retvalue = Smarty_Internal_Compile_Block::compileChildBlock($this->compiler);
} else {
// {$smarty.block.parent}
$this->_retvalue = Smarty_Internal_Compile_Block::compileParentBlock($this->compiler);
}
}