function Smarty_Compiler::_compile_capture_tag in Quiz 6.6
Same name and namespace in other branches
- 6.5 includes/moodle/lib/smarty/Smarty_Compiler.class.php \Smarty_Compiler::_compile_capture_tag()
Compile {capture} .. {/capture} tags
Parameters
boolean $start true if this is the {capture} tag:
string $tag_args:
Return value
string
1 call to Smarty_Compiler::_compile_capture_tag()
- Smarty_Compiler::_compile_tag in includes/
moodle/ lib/ smarty/ Smarty_Compiler.class.php - Compile a template tag
File
- includes/
moodle/ lib/ smarty/ Smarty_Compiler.class.php, line 1203
Class
- Smarty_Compiler
- Template compiling class @package Smarty
Code
function _compile_capture_tag($start, $tag_args = '') {
$attrs = $this
->_parse_attrs($tag_args);
if ($start) {
if (isset($attrs['name'])) {
$buffer = $attrs['name'];
}
else {
$buffer = "'default'";
}
if (isset($attrs['assign'])) {
$assign = $attrs['assign'];
}
else {
$assign = null;
}
$output = "<?php ob_start(); ?>";
$this->_capture_stack[] = array(
$buffer,
$assign,
);
}
else {
list($buffer, $assign) = array_pop($this->_capture_stack);
$output = "<?php \$this->_smarty_vars['capture'][{$buffer}] = ob_get_contents(); ";
if (isset($assign)) {
$output .= " \$this->assign({$assign}, ob_get_contents());";
}
$output .= "ob_end_clean(); ?>";
}
return $output;
}