XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
compiler.includeq.php
Go to the documentation of this file.
1 <?php
44 function smarty_compiler_includeq($tag_args, &$comp)
45 {
46  $attrs = $comp->_parse_attrs($tag_args);
47  $arg_list = array();
48 
49  if (empty($attrs['file'])) {
50  $comp->_syntax_error("missing 'file' attribute in includeq tag", E_USER_ERROR, __FILE__, __LINE__);
51  }
52 
53  foreach ($attrs as $arg_name => $arg_value) {
54  if ($arg_name == 'file') {
55  $include_file = $arg_value;
56  continue;
57  } else if ($arg_name == 'assign') {
58  $assign_var = $arg_value;
59  continue;
60  }
61  if (is_bool($arg_value)) {
62  $arg_value = $arg_value ? 'true' : 'false';
63  }
64  $arg_list[] = "'$arg_name' => $arg_value";
65  }
66 
67  $output = '';
68 
69  if (isset($assign_var)) {
70  $output .= "ob_start();\n";
71  }
72 
73  //$output .= "\$_smarty_tpl_vars = \$this->_tpl_vars;\n";
74  $_params = "array('smarty_include_tpl_file' => " . $include_file . ", 'smarty_include_vars' => array(" . implode(',', (array)$arg_list) . "))";
75  $output .= "\$this->_smarty_include($_params);\n";
76  //"\$this->_tpl_vars = \$_smarty_tpl_vars;\n" .
77  //"unset(\$_smarty_tpl_vars);\n";
78 
79  if (isset($assign_var)) {
80  $output .= "\$this->assign(" . $assign_var . ", ob_get_contents()); ob_end_clean();\n";
81  }
82  //$output .= '';
83  return $output;
84 }
85 
86 ?>