Wanting to use this in my Kohana Project

8 views
Skip to first unread message

Mathew

unread,
Jul 12, 2009, 8:27:20 PM7/12/09
to H2o template PHP
Hi and great work on this, I love the syntax! I'm looking for an
excuse to use h2o in alot of my PHP projects. Fact of the matter is
the documentation could use a little work (especially for more
advanced users). As much as I want to use h2o I find myself dropping
back to plain jane PHP for my templates. Perhaps you could show me the
error of my ways. You see sometimes there are situations where I need
to load a custom helper function from the framework (CI users and
Kohana users will know what I'm talking about.) yet sadly I find
myself fighting with h2o trying to do something as simply as this..

<h2>Blah</h2>

<ul>
<?foreach($users as $rows):?>
<?$user_prefs = _get_user_prefs($rows->id);?>
<li><?=$rows->stuff?> - <?=$user_prefs;?></li>
<?endforeach?>
</ul>

Is there any way I could do this in h2o? I feel as if I'm missing
something here. If I could somehow find a way to get over this hump.
It'll be pretty awesome! Might want to develop a (CI|Kohana) wrapper
for it as well.

Taylor luk

unread,
Aug 7, 2009, 9:25:33 AM8/7/09
to H2o template PHP
Hello methew,

Sorry for the late reply, There are a lot of interesting stuff
happening on framework integration, I have been told there are some
projects use h2o-template with frameworks such as Zend framework,
CakePHP.

At the moment the documentation require some work to show more
advanced usage of the library, It is built to be extendable and
flexible.

There are some scenario requires some custom integration to utilize
framework specific features

1. Routing and named routing support
2. Access to existing helpers such as form, html

Core philosophy
=============

In general, h2o encourage the context (variable and data you passed to
the template) to have more object-oriented design and h2o supports
advanced php objects (overloaded property, methods, array access
interface). Simple data object such as string, number, boolean,
array, hash and object works fairly well, as for function calls they
need to be adapted to become h2o filters.

In your particular example, the code will need to be something like
this.

{% for user in users %}
<li> {{ user.id }} - {{ user.preferences }}
{% endfor %}

Unfortunately, I don't have experience with CI or Kohana, however, i
did developed a cakephp custom view. If you would like to work on a
Codeigniter view adapter plugin. i will try to assist you whereever i
can.

Yours

Taylor Luk

On Jul 13, 10:27 am, Mathew <wrm...@gmail.com> wrote:
> Hi and great work on this, I love the syntax! I'm looking for an
> excuse to useh2oin alot of my PHP projects. Fact of the matter is
> the documentation could use a little work (especially for more
> advanced users). As much as I want to useh2oI find myself dropping
> back to plain jane PHP for my templates. Perhaps you could show me the
> error of my ways. You see sometimes there are situations where I need
> to load a custom helper function from the framework (CI users and
> Kohana users will know what I'm talking about.) yet sadly I find
> myself fighting withh2otrying to do something as simply as this..
>
> <h2>Blah</h2>
>
> <ul>
> <?foreach($users as $rows):?>
>    <?$user_prefs = _get_user_prefs($rows->id);?>
>    <li><?=$rows->stuff?> - <?=$user_prefs;?></li>
> <?endforeach?>
> </ul>
>
> Is there any way I could do this inh2o? I feel as if I'm missing
Reply all
Reply to author
Forward
0 new messages