127.0.0.1 - Beta

But you can call me localhost

 

tal:repeat

· Coding and stuff, Plone

Aangezien ik nog wel eens wil vergeten hoe het precies zit hier weer een stukje notitieblok voor mezelf. En voor anderen eventueel. 

This attribute handles iterable objects like array, associative arrays, and objects implementing the Iterable or Iterator interfaces (see Iterable chapter).

The repeat attribute repeat it's entity and its content until the end of the specified resource.

<tr tal:repeat="item some/result"> <td tal:content="item">text replaced by item</td> </tr>

Within a loop, you can access current loop (and parent for imbriqued loops) information using specific repeat/* pathes.

In the above example :

  • repeat/item/index : return the item index (0 to count-1)

  • repeat/item/number : returns the item number (1 to count)

  • repeat/item/even : returns true if item index is pair

  • repeat/item/odd : returns true if item index is impair

  • repeat/item/start : returns true if item is the first one

  • repeat/item/end : returns true if item is the last one

  • repeat/item/length : returns the number of elements in some/result

  • repeat/item/key : returns the item's key if some/result is an associative resource (index otherwise)

"item" depends of the receiver variable defined in tal:repeat expression.

Reageer

Reageren? Stuur een trackback (Zet Javascript aan om een Trackback URL te genereren ) of gebruik onderstaand formulier.

(optioneel veld)
(optioneel veld)

Om spammers buiten de deur te houden is het nodig dat je deze vraag beantwoord.
Persoonlijke info onthouden?
Kattebel
Verberg e-mail
Kleine lettertjes: Alle HTML-tags behalve <b> en <i> zullen uit je reactie worden verwijderd. Je maakt links door gewoon een URL of e-mailadres in te typen.