Skins

Skins as of Ringojs version 0.5

Loops

The for..in macro gives you an easy way to loop through arrays and other objects that support for-in loops in JavaScript.

<% for name in <% names %> render hello %>

Hello Benni! Hello Emma! Hello Luca! Hello Selma!

Or you can define the objects to loop through using object and array literals in the macro tag:

<% for name in [Gerlinde, Ralph, Thomas] render hello %>

Hello Gerlinde! Hello Ralph! Hello Thomas!

A predefined variable "index" is also available to provide the current index of each iteration through the loop. eg.
<% for name in [Gerlinde, Ralph, Thomas] render hello %>

<% subskin hello %>
(<% index %>) <% name %> 

(0) Hello Gerlinde! (1) Hello Ralph! (2) Hello Thomas!

Note:

Please be aware that the documentation is not yet complete for Ringo skins/templates.

Skins will be undergoing major refactoring before the next release, expect a few changes.

In the meantime, have a look at the skins demo page for a quick introduction or the bundled applications for real world examples.

edit this page | list all pages | go home