How I use h2o and thoughts

16 views
Skip to first unread message

Chuck Trukk

unread,
May 19, 2009, 5:27:10 AM5/19/09
to H2o template PHP
I use h2o for making little snippets for modx. In my __construct, I
add

require_once 'h2o.php';
$this->tplOptions = array('searchpath' => "templates",
"cache" => false);
$this->tpl = new H2o('', $this->tplOptions);
$this->tplData['title'] = $this->action;

Then in each method, I can just call:
$this->tplData['content'] = 'my content string'; //$this-
>tplData is a property holding all the data to be sent to h2o for
rendering.
$this->tpl->loadTemplate('base.tpl');
echo $this->tpl->render($this->tplData);

This works really well at letting me set the defaults at one place.
But does not work in .4. In .4, you have to supple a file when you
instantiate h2o.

Taylor luk

unread,
May 19, 2009, 7:54:03 AM5/19/09
to H2o template PHP
Hello chunk,

I have just committed some updates to support loading templates
lazily, please checkout the latest version to see if it fixes your
problem..


Thanks :)
Reply all
Reply to author
Forward
0 new messages