当前位置: 首页>>代码示例>>PHP>>正文


PHP Engine::exists方法代码示例

本文整理汇总了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]);
 }
开发者ID:elevenone,项目名称:spark-project-foundation,代码行数:28,代码来源:StaticPage.php

示例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";
     }
 }
开发者ID:louislam,项目名称:louislam-crud,代码行数:18,代码来源:LouisCRUD.php

示例3: exists

 /**
  * Returns whether or not the given template exists.
  *
  * @param string $template
  *
  * @return bool
  */
 public function exists($template)
 {
     return $this->plates->exists($template);
 }
开发者ID:Symfomany,项目名称:laravelcinema,代码行数:11,代码来源:PlatesEngineAdapter.php

示例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'));
 }
开发者ID:tonis-io,项目名称:tonis,代码行数:5,代码来源:PlatesStrategyTest.php

示例5: canRender

 /**
  * {@inheritDoc}
  */
 public function canRender($template)
 {
     return $this->engine->exists($template);
 }
开发者ID:tonis-io,项目名称:tonis,代码行数:7,代码来源:PlatesStrategy.php


注:本文中的League\Plates\Engine::exists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。