本文整理匯總了PHP中H2o::loadTemplate方法的典型用法代碼示例。如果您正苦於以下問題:PHP H2o::loadTemplate方法的具體用法?PHP H2o::loadTemplate怎麽用?PHP H2o::loadTemplate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類H2o
的用法示例。
在下文中一共展示了H2o::loadTemplate方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: should_render_inherited_template
public function should_render_inherited_template()
{
$h2o = new H2o('inherited.html', $this->option);
expects($h2o->render())->should_be('header,extended body,footer');
# extend nested blocks
$h2o->loadTemplate('nested_inherit');
expects($h2o->render())->should_be('h2o template rocks so hard ! and plays so hard');
}
示例2: should_be_able_to_load_template_lazily
public function should_be_able_to_load_template_lazily()
{
$h2o = new H2o('a.html', array('searchpath' => 'templates'));
expects($h2o->render())->should_not_be_empty();
$h2o = new H2o(null, array('searchpath' => 'templates'));
$h2o->loadTemplate('b.html');
expects($h2o->render())->should_not_be_empty();
}
示例3: chdir
function should_be_able_to_load_template_lazily()
{
chdir(dirname(__FILE__));
$paths = array(dirname(__FILE__) . DS . 'templates' . DS);
$h2o = h2o('a.html', array('searchpath' => $paths));
expects($h2o->render())->should_not_be_empty();
$h2o = new H2o('a.html', array('searchpath' => 'templates'));
expects($h2o->render())->should_not_be_empty();
$h2o = new H2o(null, array('searchpath' => 'templates'));
$h2o->loadTemplate('b.html');
expects($h2o->render())->should_not_be_empty();
}