« Back to the index
\core\WATemplate loops example
The table with a simple loop template:
{{title}}
[[data]]
{{id}} | {{name}} | {{statusname}} |
[[]]
The same table with an alternate template:
{{title}}
[[template2.loop]]
{{id}} | {{name}} | {{statusname}} |
[[]]
[[template2.loopalt]]
{{id}} | {{name}} | {{statusname}} |
[[]]
The same table with an alternate template and special lines templates:
{{title}}
@@data:template3:status@@
[[template3.key.6]]
{{id}} | {{name}} | {{statusname}} |
[[]]
[[template3.sel.3]]
{{id}} | {{name}} | {{statusname}} |
[[]]
[[template3.loop]]
{{id}} | {{name}} | {{statusname}} |
[[]]
[[template3.loopalt]]
{{id}} | {{name}} | {{statusname}} |
[[]]
EOF;
$data = array(
'title' => 'Hotels projects:',
'data' => array(
array('id' => 1, 'name' => 'Paris', 'status' => 1, 'statusname' => 'In project'),
array('id' => 2, 'name' => 'London', 'status' => 1, 'statusname' => 'In project'),
array('id' => 3, 'name' => 'Madrid', 'status' => 2, 'statusname' => 'In construction'),
array('id' => 4, 'name' => 'New York', 'status' => 3, 'statusname' => 'Finished'),
array('id' => 5, 'name' => 'Los Angeles', 'status' => 1, 'statusname' => 'In project'),
array('id' => 6, 'name' => 'Mexico City', 'status' => 1, 'statusname' => 'In project'),
array('id' => 7, 'name' => 'Moscu', 'status' => 1, 'statusname' => 'In project'),
array('id' => 8, 'name' => 'Roma', 'status' => 1, 'statusname' => 'In project'),
array('id' => 9, 'name' => 'Berlin', 'status' => 3, 'statusname' => 'Finished'),
)
);
$temp = new \core\WATemplate($template);
$temp->metaElements($data, false, true);
print $temp;
?>
« Back to the index