Chuck Trukk
unread,May 19, 2009, 5:27:10 AM5/19/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
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.