<?php
/**
* Gedar Template Engine plugin
* @package Gedar
* @subpackage plugins
*/
/**
* Gedar {cycle} function<br/>
*<br/>
* <b>Type:</b> function<br/>
* <b>Name:</b> cycle<br/>
* <b>Purpose:</b> rotate between set of values<br/>
* @authur ali masoudi <me@alimasoudi.com>
* @param array $name
* @param object $gedar
* @see _compileCycleTag()
* @return the current item during cycling
*/
function gedar_cycle_do($name,&$gedar)
{
static $no=0;
$no=!$no?0:$no;
$gedar->_tmpVar=stripslashes($gedar->_TplSpecialVars["_cycle"][$name]["elements"]);
eval('$items='.$gedar->_tmpVar.';');
$Items=explode(',',$items);
$gedar->_TplSpecialVars['_cycle'][$name]['no']=count($Items);
$gedar->_TplVars['_cycle'][$name]=$Items[$no];
$no++;
$no=$no%$gedar->_TplSpecialVars['_cycle'][$name]['no'];
$gedar->_outputVal=$gedar->_TplVars['_cycle'][$name];
return $gedar->_outputVal;
}
?>
|