PEEL Shopping
Open source ecommerce : PEEL Shopping
smarty_internal_compile_while.php
Go to the documentation of this file.
1 <?php
19 
28  public function compile($args, $compiler, $parameter)
29  {
30  // check and get attributes
31  $_attr = $this->getAttributes($compiler, $args);
32  $this->openTag($compiler, 'while', $compiler->nocache);
33 
34  if (!array_key_exists("if condition",$parameter)) {
35  $compiler->trigger_template_error("missing while condition", $compiler->lex->taglineno);
36  }
37 
38  // maybe nocache because of nocache variables
39  $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
40  if (is_array($parameter['if condition'])) {
41  if ($compiler->nocache) {
42  $_nocache = ',true';
43  // create nocache var to make it know for further compiling
44  if (is_array($parameter['if condition']['var'])) {
45  $compiler->template->tpl_vars[trim($parameter['if condition']['var']['var'], "'")] = new Smarty_variable(null, true);
46  } else {
47  $compiler->template->tpl_vars[trim($parameter['if condition']['var'], "'")] = new Smarty_variable(null, true);
48  }
49  } else {
50  $_nocache = '';
51  }
52  if (is_array($parameter['if condition']['var'])) {
53  $_output = "<?php if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]) || !is_array(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value)) \$_smarty_tpl->createLocalArrayVariable(" . $parameter['if condition']['var']['var'] . "$_nocache);\n";
54  $_output .= "while (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value" . $parameter['if condition']['var']['smarty_internal_index'] . " = " . $parameter['if condition']['value'] . "){?>";
55  } else {
56  $_output = "<?php if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "])) \$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "] = new Smarty_Variable(null{$_nocache});";
57  $_output .= "while (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "]->value = " . $parameter['if condition']['value'] . "){?>";
58  }
59  return $_output;
60  } else {
61  return "<?php while ({$parameter['if condition']}){?>";
62  }
63  }
64 
65 }
66 
74 
82  public function compile($args, $compiler)
83  {
84  // must endblock be nocache?
85  if ($compiler->nocache) {
86  $compiler->tag_nocache = true;
87  }
88  $compiler->nocache = $this->closeTag($compiler, array('while'));
89  return "<?php }?>";
90  }
91 
92 }
93 
94 ?>
compile($args, $compiler)
Compiles code for the {/while} tag.
compile($args, $compiler, $parameter)
Compiles code for the {while} tag.
openTag($compiler, $openTag, $data=null)
Push opening tag name on stack.
getAttributes($compiler, $attributes)
This function checks if the attributes passed are valid.
closeTag($compiler, $expectedTag)
Pop closing tag.

This documentation for Open ecommerce PEEL Shopping and PEEL.fr has been generated by Doxygen on Thu Oct 15 2015 14:41:17 - Peel ecommerce is a product of Agence web Advisto SAS. All rights reserved.