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


PHP ViewFactory::get_template_type方法代码示例

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


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

示例1: make_view

 static function make_view($template, $layout = false)
 {
     # get the template type
     $template = PROJECT_VIEWS . '/' . $template;
     $type = ViewFactory::get_template_type($template);
     if ($type === false) {
         throw new MissingTemplate("No recognizable template was found at {$template}.");
     }
     # return the right view depending on the extension of the template
     switch ($type) {
         case 'phtml':
             $the_view = new PHTMLView("{$template}.{$type}");
             break;
         case 'pxml':
             $the_view = new PXMLView("{$template}.{$type}");
             break;
         case 'pjs':
             $the_view = new PJSView("{$template}.{$type}");
             break;
         case 'xsl':
             $the_view = new XSLTView("{$template}.{$type}");
             break;
         default:
             throw new UnknownViewType("ViewFactory doesn't know how to use a {$type} file.");
     }
     return $the_view;
 }
开发者ID:brysonian,项目名称:Saint,代码行数:27,代码来源:ViewFactory.php

示例2: parse

 function parse($layout_template = false)
 {
     parent::parse($layout_template);
     # unpack the props
     #extract($this->props);
     # trap the buffer
     ob_start();
     # include the template
     include $this->template;
     # get the buffer contents
     $parsed = ob_get_contents();
     # clean the buffer
     ob_clean();
     # if there is a layout
     if ($this->layout) {
         # find the type
         $type = ViewFactory::get_template_type($layout_template);
         if ($type) {
             # push the content into the layout
             $content_for_layout = $parsed;
             # include the template
             include $this->layout . ".{$type}";
             # get the buffer contents
             $parsed = ob_get_contents();
         }
     }
     # close the output buffer
     ob_end_clean();
     # save the result
     $this->parsed = $parsed;
     return $parsed;
 }
开发者ID:brysonian,项目名称:Saint,代码行数:32,代码来源:PHTMLView.php


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