developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Ticket #149: function.cycle_reset.php

File function.cycle_reset.php, 1014 bytes (added by dubphil, 13 years ago)

reset du cycle

Line 
1<?php
2/**
3 * @package     jelix
4 * @subpackage  jtpl_plugin
5 * @author      Philippe SCHELTE < dubphil >
6 * @copyright   2008 Philippe SCHELTE
7 * @link        http://jelix.org/
8 * @licence     GNU Lesser General Public Licence see LICENCE file or http://www.gnu.org/licenses/lgpl.html
9 */
10
11/**
12 * Type:     function<br>
13 * Name:     cycle_reset<br>
14 * Date:     Feb, 2008<br>
15 * Purpose:  reset the cycle of a given cycle name or the default<br>
16 * Input:
17 *         - name = name of cycle (optional)
18 *
19 * Examples:<br>
20 * <pre>
21 * {cycle_reset 'name'}
22 * {cycle_reset}
23 * </pre>
24 * @param $tpl
25 * @param string
26 * @return 1
27 */
28function jtpl_function_common_cycle_reset($tpl, $name='') {
29    $cycle_name = $name ? $name : 'default';
30    if(isset($tpl->_privateVars['cycle'][$cycle_name])){
31        $tpl->_privateVars['cycle'][$cycle_name]['index'] = 0;
32    } else {
33        throw new jException("jelix~errors.tplplugin.function.argument.unknow", array($cycle_name,'cycle',''));
34        return; 
35    }
36    return; 
37}
38?>