Código:
{section name=year start=$tsEndY loop=$tsEndY step=-1 max=$tsMax}
<option value="{$smarty.section.year.index}">{$smarty.section.year.index}</option>
{/section}
y quisiera pasarla a puro codigo php, pero no se como se haría esto en php,
yo se que hace con un for, por no se como.
quisiera que por favor me ayudaran.
Esta es la que arroja el php del cache del smarty, como veran es mucho codigo basura, quisiera simplificarlo ya que actualmente estoy haciendo un convertidor de plantillas smarty a solamente php con python.
Código:
<?php unset($this->_sections['dias']);
$this->_sections['dias']['name'] = 'dias';
$this->_sections['dias']['start'] = (int)1;
$this->_sections['dias']['loop'] = is_array($_loop=32) ? count($_loop) : max(0, (int)$_loop); unset($_loop);
$this->_sections['dias']['show'] = true;
$this->_sections['dias']['max'] = $this->_sections['dias']['loop'];
$this->_sections['dias']['step'] = 1;
if ($this->_sections['dias']['start'] < 0)
$this->_sections['dias']['start'] = max($this->_sections['dias']['step'] > 0 ? 0 : -1, $this->_sections['dias']['loop'] + $this->_sections['dias']['start']);
else
$this->_sections['dias']['start'] = min($this->_sections['dias']['start'], $this->_sections['dias']['step'] > 0 ? $this->_sections['dias']['loop'] : $this->_sections['dias']['loop']-1);
if ($this->_sections['dias']['show']) {
$this->_sections['dias']['total'] = min(ceil(($this->_sections['dias']['step'] > 0 ? $this->_sections['dias']['loop'] - $this->_sections['dias']['start'] : $this->_sections['dias']['start']+1)/abs($this->_sections['dias']['step'])), $this->_sections['dias']['max']);
if ($this->_sections['dias']['total'] == 0)
$this->_sections['dias']['show'] = false;
} else
$this->_sections['dias']['total'] = 0;
if ($this->_sections['dias']['show']):
for ($this->_sections['dias']['index'] = $this->_sections['dias']['start'], $this->_sections['dias']['iteration'] = 1;
$this->_sections['dias']['iteration'] <= $this->_sections['dias']['total'];
$this->_sections['dias']['index'] += $this->_sections['dias']['step'], $this->_sections['dias']['iteration']++):
$this->_sections['dias']['rownum'] = $this->_sections['dias']['iteration'];
$this->_sections['dias']['index_prev'] = $this->_sections['dias']['index'] - $this->_sections['dias']['step'];
$this->_sections['dias']['index_next'] = $this->_sections['dias']['index'] + $this->_sections['dias']['step'];
$this->_sections['dias']['first'] = ($this->_sections['dias']['iteration'] == 1);
$this->_sections['dias']['last'] = ($this->_sections['dias']['iteration'] == $this->_sections['dias']['total']);
?>
<option value="<?php echo $this->_sections['dias']['index']; ?>
"><?php echo $this->_sections['dias']['index']; ?>
</option>
<?php endfor; endif; ?>
GRACIAS.