gehe zur Dokumentation dieser Datei
35 public function compile($args, $compiler, $parameter)
37 if ($parameter == 0) {
38 $this->required_attributes = array(
'start',
'to');
39 $this->optional_attributes = array(
'max',
'step');
41 $this->required_attributes = array(
'start',
'ifexp',
'var',
'step');
42 $this->optional_attributes = array();
48 if ($parameter == 1) {
49 foreach ($_attr[
'start'] as $_statement) {
50 if (is_array($_statement[
'var'])) {
51 $var = $_statement[
'var'][
'var'];
52 $index = $_statement[
'var'][
'smarty_internal_index'];
54 $var = $_statement[
'var'];
57 $output .=
" \$_smarty_tpl->tpl_vars[$var] = new Smarty_Variable;";
58 $output .=
" \$_smarty_tpl->tpl_vars[$var]->value{$index} = $_statement[value];\n";
60 if (is_array($_attr[
'var'])) {
61 $var = $_attr[
'var'][
'var'];
62 $index = $_attr[
'var'][
'smarty_internal_index'];
67 $output .=
" if ($_attr[ifexp]) { for (\$_foo=true;$_attr[ifexp]; \$_smarty_tpl->tpl_vars[$var]->value{$index}$_attr[step]) {\n";
69 $_statement = $_attr[
'start'];
70 if (is_array($_statement[
'var'])) {
71 $var = $_statement[
'var'][
'var'];
72 $index = $_statement[
'var'][
'smarty_internal_index'];
74 $var = $_statement[
'var'];
77 $output .=
"\$_smarty_tpl->tpl_vars[$var] = new Smarty_Variable;";
78 if (isset($_attr[
'step'])) {
79 $output .=
"\$_smarty_tpl->tpl_vars[$var]->step = $_attr[step];";
81 $output .=
"\$_smarty_tpl->tpl_vars[$var]->step = 1;";
83 if (isset($_attr[
'max'])) {
84 $output .=
"\$_smarty_tpl->tpl_vars[$var]->total = (int) min(ceil((\$_smarty_tpl->tpl_vars[$var]->step > 0 ? $_attr[to]+1 - ($_statement[value]) : $_statement[value]-($_attr[to])+1)/abs(\$_smarty_tpl->tpl_vars[$var]->step)),$_attr[max]);\n";
86 $output .=
"\$_smarty_tpl->tpl_vars[$var]->total = (int) ceil((\$_smarty_tpl->tpl_vars[$var]->step > 0 ? $_attr[to]+1 - ($_statement[value]) : $_statement[value]-($_attr[to])+1)/abs(\$_smarty_tpl->tpl_vars[$var]->step));\n";
88 $output .=
"if (\$_smarty_tpl->tpl_vars[$var]->total > 0) {\n";
89 $output .=
"for (\$_smarty_tpl->tpl_vars[$var]->value{$index} = $_statement[value], \$_smarty_tpl->tpl_vars[$var]->iteration = 1;\$_smarty_tpl->tpl_vars[$var]->iteration <= \$_smarty_tpl->tpl_vars[$var]->total;\$_smarty_tpl->tpl_vars[$var]->value{$index} += \$_smarty_tpl->tpl_vars[$var]->step, \$_smarty_tpl->tpl_vars[$var]->iteration++) {\n";
90 $output .=
"\$_smarty_tpl->tpl_vars[$var]->first = \$_smarty_tpl->tpl_vars[$var]->iteration == 1;";
91 $output .=
"\$_smarty_tpl->tpl_vars[$var]->last = \$_smarty_tpl->tpl_vars[$var]->iteration == \$_smarty_tpl->tpl_vars[$var]->total;";
95 $this->
openTag($compiler,
'for', array(
'for', $compiler->nocache));
97 $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
120 public function compile($args, $compiler, $parameter)
125 list($openTag, $nocache) = $this->
closeTag($compiler, array(
'for'));
126 $this->
openTag($compiler,
'forelse', array(
'forelse', $nocache));
128 return "<?php }} else { ?>";
149 public function compile($args, $compiler, $parameter)
154 if ($compiler->nocache) {
155 $compiler->tag_nocache =
true;
158 list($openTag, $compiler->nocache) = $this->
closeTag($compiler, array(
'for',
'forelse'));
160 if ($openTag ==
'forelse') {
163 return "<?php }} ?>";
Sie sind hier: Home » MyOOS Benutzerhandbuch » Smarty
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.