本文整理汇总了PHP中League\Plates\Engine::exists方法的典型用法代码示例。如果您正苦于以下问题:PHP Engine::exists方法的具体用法?PHP Engine::exists怎么用?PHP Engine::exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类League\Plates\Engine
的用法示例。
在下文中一共展示了Engine::exists方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __invoke
public function __invoke(array $input)
{
$name = 'index';
if (!empty($input['name'])) {
$name = $input['name'];
}
// $filename = APPPATH . 'templates/static/' . $name;
// if (file_exists($filename)) {
// echo "The file $filename does not exist";
// die('the file does not exist');
// }
// Create new Plates instance
$plates = new Engine(APPPATH . 'templates');
// Register extension
$plates->loadExtension(new Utils());
// Check static page or partial exists
if ($plates->exists('static/' . $name)) {
// Render a template
$template = $plates->render('static/' . $name);
} else {
header("HTTP/1.0 404 Not Found");
echo "PHP continues.\n";
echo "Not after a die, however.\n";
die;
}
// return
return (new Payload())->withStatus(Payload::OK)->withOutput(['hello' => $template]);
}
示例2: getLayoutName
/**
* Get Current Layout Name in Plates Template Engine style
* If user have created a layout.php in the default folder, use their layout.php.
* Or else use the default layout.
*
* @return string Layout Name
*/
private function getLayoutName()
{
if ($this->layout != null) {
return $this->layout;
}
try {
return $this->template->exists("backend_layout") ? "backend_layout" : $this->theme . "::layout";
} catch (\LogicException $ex) {
return $this->theme . "::layout";
}
}
示例3: exists
/**
* Returns whether or not the given template exists.
*
* @param string $template
*
* @return bool
*/
public function exists($template)
{
return $this->plates->exists($template);
}
示例4: testCanRender
public function testCanRender()
{
$this->assertSame($this->engine->exists('does-not-exist'), $this->strategy->canRender('does-not-exist'));
$this->assertSame($this->engine->exists('simple'), $this->strategy->canRender('simple'));
}
示例5: canRender
/**
* {@inheritDoc}
*/
public function canRender($template)
{
return $this->engine->exists($template);
}