libs/sysplugins/smarty_internal_compile_extends.php Quellcode

smarty_internal_compile_extends.php
gehe zur Dokumentation dieser Datei
1 <?php
2 
19 {
26  public $required_attributes = array('file');
33  public $shorttag_order = array('file');
34 
43  public function compile($args, $compiler)
44  {
45  // check and get attributes
46  $_attr = $this->getAttributes($compiler, $args);
47  if ($_attr['nocache'] === true) {
48  $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);
49  }
50  if (strpos($_attr['file'], '$_tmp') !== false) {
51  $compiler->trigger_template_error('illegal value for file attribute', $compiler->lex->taglineno);
52  }
53 
54  $name = $_attr['file'];
58  $_smarty_tpl = $compiler->template;
59  eval("\$tpl_name = $name;");
60  // create template object
61  $_template = new $compiler->smarty->template_class($tpl_name, $compiler->smarty, $compiler->template);
62  // check for recursion
63  $uid = $_template->source->uid;
64  if (isset($compiler->extends_uid[$uid])) {
65  $compiler->trigger_template_error("illegal recursive call of \"$include_file\"", $compiler->lex->line - 1);
66  }
67  $compiler->extends_uid[$uid] = true;
68  if (empty($_template->source->components)) {
69  array_unshift($compiler->sources, $_template->source);
70  } else {
71  foreach ($_template->source->components as $source) {
72  array_unshift($compiler->sources, $source);
73  $uid = $source->uid;
74  if (isset($compiler->extends_uid[$uid])) {
75  $compiler->trigger_template_error("illegal recursive call of \"{$source->filepath}\"", $compiler->lex->line - 1);
76  }
77  $compiler->extends_uid[$uid] = true;
78  }
79  }
80  unset ($_template);
81  $compiler->inheritance_child = true;
82  $compiler->lex->yypushstate(Smarty_Internal_Templatelexer::CHILDBODY);
83  return '';
84  }
85 }




Korrekturen, Hinweise und Ergänzungen

Bitte scheuen Sie sich nicht und melden Sie, was auf dieser Seite sachlich falsch oder irreführend ist, was ergänzt werden sollte, was fehlt usw. Dazu bitte oben aus dem Menü Seite den Eintrag Support Forum wählen. Es ist eine kostenlose Anmeldung erforderlich, um Anmerkungen zu posten. Unpassende Postings, Spam usw. werden kommentarlos entfernt.