libs/sysplugins/smarty_internal_compile_continue.php Quellcode

smarty_internal_compile_continue.php
gehe zur Dokumentation dieser Datei
1 <?php
18 {
25  public $optional_attributes = array('levels');
32  public $shorttag_order = array('levels');
33 
43  public function compile($args, $compiler, $parameter)
44  {
45  static $_is_loopy = array('for' => true, 'foreach' => true, 'while' => true, 'section' => true);
46  // check and get attributes
47  $_attr = $this->getAttributes($compiler, $args);
48 
49  if ($_attr['nocache'] === true) {
50  $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);
51  }
52 
53  if (isset($_attr['levels'])) {
54  if (!is_numeric($_attr['levels'])) {
55  $compiler->trigger_template_error('level attribute must be a numeric constant', $compiler->lex->taglineno);
56  }
57  $_levels = $_attr['levels'];
58  } else {
59  $_levels = 1;
60  }
61  $level_count = $_levels;
62  $stack_count = count($compiler->_tag_stack) - 1;
63  while ($level_count > 0 && $stack_count >= 0) {
64  if (isset($_is_loopy[$compiler->_tag_stack[$stack_count][0]])) {
65  $level_count --;
66  }
67  $stack_count --;
68  }
69  if ($level_count != 0) {
70  $compiler->trigger_template_error("cannot continue {$_levels} level(s)", $compiler->lex->taglineno);
71  }
72 
73  return "<?php continue {$_levels};?>";
74  }
75 }




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.