本文整理汇总了PHP中Mustache_Engine::loadPartial方法的典型用法代码示例。如果您正苦于以下问题:PHP Mustache_Engine::loadPartial方法的具体用法?PHP Mustache_Engine::loadPartial怎么用?PHP Mustache_Engine::loadPartial使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mustache_Engine
的用法示例。
在下文中一共展示了Mustache_Engine::loadPartial方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testLoadPartialCascading
public function testLoadPartialCascading()
{
$loader = new Mustache_Loader_ArrayLoader(array('foo' => 'FOO'));
$mustache = new Mustache_Engine(array('loader' => $loader));
$tpl = $mustache->loadTemplate('foo');
$this->assertSame($tpl, $mustache->loadPartial('foo'));
$mustache->setPartials(array('foo' => 'f00'));
// setting partials overrides the default template loading fallback.
$this->assertNotSame($tpl, $mustache->loadPartial('foo'));
// but it didn't overwrite the original template loader templates.
$this->assertSame($tpl, $mustache->loadTemplate('foo'));
}
示例2: _load_theme_template
/**
* Loads the Mustache template or partial for the active theme.
*
* @param array $theme Meta headers for the active theme
* @param array $settings Gallery shortcode settings
* @return void
*/
protected function _load_theme_template($theme, $settings)
{
$loaders = array_merge(self::_load_theme_template_override($theme['plugin_override_path']), array(new Mustache_Loader_FilesystemLoader($theme['plugin_path'])));
$partial_loaders = array_merge(self::_load_theme_template_override($theme['partials_override_path']), array(new Mustache_Loader_FilesystemLoader($theme['partials_path'])));
$mustache = new Mustache_Engine(array('loader' => new Mustache_Loader_CascadingLoader($loaders), 'partials_loader' => new Mustache_Loader_CascadingLoader($partial_loaders)));
$this->_template = isset($settings['partial']) ? $mustache->loadPartial(strtolower($settings['partial'])) : $mustache->loadTemplate(strtolower($theme['name']));
// Backwards-Compatibility for Vimeography Pro < 0.7
$this->_theme = $this->_template;
}