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


PHP Blade::view方法代码示例

本文整理汇总了PHP中Blade::view方法的典型用法代码示例。如果您正苦于以下问题:PHP Blade::view方法的具体用法?PHP Blade::view怎么用?PHP Blade::view使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Blade的用法示例。


在下文中一共展示了Blade::view方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: view

 /**
  * Метод подключения шаблонов
  * @param  string  $view   имя шаблона
  * @param  array   $params массив параметров
  * @param  boolean $return выводить или возвращать код
  * @return string          сформированный код
  */
 public static function view($template, $params = [], $return = false)
 {
     $blade = new Blade(APP . '/views', STORAGE . '/cache');
     if ($return) {
         return $blade->view()->make($template, $params)->render();
     } else {
         echo $blade->view()->make($template, $params)->render();
     }
 }
开发者ID:visavi,项目名称:rotorcms,代码行数:16,代码来源:App.php

示例2: blade_include

 /**
  * Include the template
  * @return string
  */
 public function blade_include($template)
 {
     if (!$template) {
         return $template;
     }
     // Noting to do here. Come back later.
     // all templates for our engine must live in the template directory
     if (stripos($template, get_template_directory()) === FALSE) {
         return $template;
     }
     if ($this->viewExpired($template)) {
         // get the base name
         $file = basename($template);
         // with a blade extension, we have to do this because blade wont recognize the root files without the .blade.php extension
         $blade = str_replace('.php', '.blade.php', $file);
         $blade_file = $this->view_cache . '/' . $blade;
         // get the code
         $code = file_get_contents($template);
         // add the code to the cached blade file
         file_put_contents($blade_file, $code);
         // blade friendly name
         $view = str_replace('.php', '', $file);
         // find a controller
         $controller = $this->getController($view);
         // run the blade code
         echo $this->blade->view()->make('cache.' . $view)->with(['data' => $controller ? $controller->process() : []])->render();
         // halt including
         return '';
     } else {
         // get the base name
         $file = basename($template);
         // blade friendly name
         $view = str_replace('.php', '', $file);
         // find a controller
         $controller = $this->getController($view);
         // run the blade code
         echo $this->blade->view()->make('cache.' . $view)->with(['data' => $controller ? $controller->process() : []])->render();
         // halt including
         return '';
     }
     // return an empty string to stop wordpress from including the template when we are doing it
     return $template;
 }
开发者ID:NikolaGrdanjski,项目名称:wp-blade,代码行数:47,代码来源:Blade.php

示例3: bladePage

 public static function bladePage($page = '', $data = '', $obGetContents = false)
 {
     return Blade::view($page, $data, $obGetContents);
 }
开发者ID:Allopa,项目名称:ZN-Framework-Starter,代码行数:4,代码来源:Import.php


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