« Back to the index
\core\WATemplate conditional example
The table with a simple loop template and a conditional flag:
{{title}}
[[data]]
{{id}} | {{name}} | {{statusname}} | ??flag?? |
[[flag]]
[[]]
[[flag.none]]
N/A
[[]]
[[]]
EOF;
$temp = new \core\WATemplate($template);
$data = array(
'title' => 'Hotels projects:',
'data' => array(
array('id' => 1, 'name' => 'Paris', 'status' => 1, 'statusname' => 'In project', 'flag' => 'fr.gif'),
array('id' => 2, 'name' => 'London', 'status' => 1, 'statusname' => 'In project', 'flag' => 'uk.gif'),
array('id' => 3, 'name' => 'Madrid', 'status' => 2, 'statusname' => 'In construction'),
array('id' => 4, 'name' => 'New York', 'status' => 3, 'statusname' => 'Finished', 'flag' => 'us.gif'),
array('id' => 5, 'name' => 'Los Angeles', 'status' => 1, 'statusname' => 'In project', 'flag' => 'us.gif'),
array('id' => 6, 'name' => 'Mexico City', 'status' => 1, 'statusname' => 'In project', 'flag' => 'mx.gif'),
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->metaElements($data, false, true);
print $temp->resolve();
?>
« Back to the index