42 public function compile($args, $compiler, $parameter)
44 static $_is_loopy = array(
'for' =>
true,
'foreach' =>
true,
'while' =>
true,
'section' =>
true);
48 if ($_attr[
'nocache'] ===
true) {
49 $compiler->trigger_template_error(
'nocache option not allowed', $compiler->lex->taglineno);
52 if (isset($_attr[
'levels'])) {
53 if (!is_numeric($_attr[
'levels'])) {
54 $compiler->trigger_template_error(
'level attribute must be a numeric constant', $compiler->lex->taglineno);
56 $_levels = $_attr[
'levels'];
60 $level_count = $_levels;
61 $stack_count = count($compiler->_tag_stack) - 1;
62 while ($level_count > 0 && $stack_count >= 0) {
63 if (isset($_is_loopy[$compiler->_tag_stack[$stack_count][0]])) {
68 if ($level_count != 0) {
69 $compiler->trigger_template_error(
"cannot break {$_levels} level(s)", $compiler->lex->taglineno);
71 $compiler->has_code =
true;
72 return "<?php break {$_levels}?>";
getAttributes($compiler, $attributes)
This function checks if the attributes passed are valid.
compile($args, $compiler, $parameter)
Compiles code for the {break} tag.