\Pluf_Template_Tag_Cycle

Template tag <code>cycle</code>.

Cycle among the given strings or variables each time this tag is encountered.

Within a loop, cycles among the given strings each time through the loop:

{foreach $some_list as $obj}

...

{/foreach}

You can use variables, too. For example, if you have two template variables, $rowvalue1 and $rowvalue2, you can cycle between their values like this:

{foreach $some_list as $obj}

...

{/foreach}

You can mix variables and strings:

{foreach $some_list as $obj}

...

{/foreach}

In some cases you might want to refer to the next value of a cycle from outside of a loop. To do this, just group the arguments into an array and give the {cycle} tag name last, like this:

{cycle array('row1', 'row2'), 'rowcolors'}

From then on, you can insert the current value of the cycle wherever you'd like in your template:

... ...

Based on concepts from the Django cycle template tag.

Summary

Methods
Properties
Constants
__construct()
start()
No public properties found
No constants found
_computeIndex()
$context
N/A
No private methods found
No private properties found
N/A

Properties

$context

$context : array

Type

array

Methods

__construct()

__construct(  $context = null) 

Constructor.

Parameters

$context

start()

start() 

Throws

\InvalidArgumentException

If no argument is provided.

_computeIndex()

_computeIndex(  $args) : array

Compute an index for the given array.

Parameters

$args

Returns

array —

A array of two elements: key and index.