本文整理汇总了PHP中SSViewer::includeRequirements方法的典型用法代码示例。如果您正苦于以下问题:PHP SSViewer::includeRequirements方法的具体用法?PHP SSViewer::includeRequirements怎么用?PHP SSViewer::includeRequirements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SSViewer
的用法示例。
在下文中一共展示了SSViewer::includeRequirements方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testProcessOnlyIncludesRequirementsOnce
public function testProcessOnlyIncludesRequirementsOnce()
{
$template = new SSViewer(array('SSViewerTestProcess'));
$basePath = dirname($this->getCurrentRelativePath()) . '/forms';
$backend = new Requirements_Backend();
$backend->set_combined_files_enabled(false);
$backend->combine_files('RequirementsTest_ab.css', array($basePath . '/RequirementsTest_a.css', $basePath . '/RequirementsTest_b.css'));
Requirements::set_backend($backend);
$this->assertEquals(1, substr_count($template->process(array()), "a.css"));
$this->assertEquals(1, substr_count($template->process(array()), "b.css"));
// if we disable the requirements then we should get nothing
$template->includeRequirements(false);
$this->assertEquals(0, substr_count($template->process(array()), "a.css"));
$this->assertEquals(0, substr_count($template->process(array()), "b.css"));
}
示例2: execute_template
/**
* Execute the given template, passing it the given data.
* Used by the <% include %> template tag to process templates.
*
* @param string $template Template name
* @param mixed $data Data context
* @param array $arguments Additional arguments
* @return string Evaluated result
*/
public static function execute_template($template, $data, $arguments = null, $scope = null)
{
$v = new SSViewer($template);
$v->includeRequirements(false);
return $v->process($data, $arguments, $scope);
}
示例3: RenderLayout
/**
* Mimics the bevahiour of $Layout in templates
* @return HTMLText
*/
public function RenderLayout()
{
$template = $this->findLayout();
$subtemplateViewer = new SSViewer($template);
$subtemplateViewer->includeRequirements(false);
return $subtemplateViewer->process($this->getOwner());
}