The basis is like any template class.
// Controller:
$data['user'] = $model->getUser();
$data['comments'] = $model->getAllComments();
$tpl = new h2o('comments.tpl');
$tpl->render($data);
// comments.tpl
{% for comment in comments %}
{% if user = "admin" %}
<div class="comments by-admin"
{% else %}
<div class="comments">
{% endif %}
Comments go here.....
</div>
{% endfor %}
That’s a really simple example. What I like about it:
- no need for inner and outer chunks
- it’s got PHx like modifiers (or smarty-like if you will)
- i think the django syntax is really really clean
- This is really for designers who know some html but php scares the hell out of them. (I am starting to like plain php/helper functions in my view, but alas)