function Smarty_Compiler::_compile_include_php_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_include_php_tag()
Compile {include ...} tag
Parameters
string $tag_args:
Return value
string
1 call to Smarty_Compiler::_compile_include_php_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 1005
Class
- Smarty_Compiler
- Template compiling class @package Smarty
Code
function _compile_include_php_tag($tag_args) {
$attrs = $this
->_parse_attrs($tag_args);
if (empty($attrs['file'])) {
$this
->_syntax_error("missing 'file' attribute in include_php tag", E_USER_ERROR, __FILE__, __LINE__);
}
$assign_var = empty($attrs['assign']) ? '' : $this
->_dequote($attrs['assign']);
$once_var = empty($attrs['once']) || $attrs['once'] == 'false' ? 'false' : 'true';
$arg_list = array();
foreach ($attrs as $arg_name => $arg_value) {
if ($arg_name != 'file' and $arg_name != 'once' and $arg_name != 'assign') {
if (is_bool($arg_value)) {
$arg_value = $arg_value ? 'true' : 'false';
}
$arg_list[] = "'{$arg_name}' => {$arg_value}";
}
}
$_params = "array('smarty_file' => " . $attrs['file'] . ", 'smarty_assign' => '{$assign_var}', 'smarty_once' => {$once_var}, 'smarty_include_vars' => array(" . implode(',', $arg_list) . "))";
return "<?php require_once(SMARTY_CORE_DIR . 'core.smarty_include_php.php');\nsmarty_core_smarty_include_php({$_params}, \$this); ?>" . $this->_additional_newline;
}