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


PHP JControllerLegacy::views方法代码示例

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


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

示例1: getView

 /**
  * Method to get a reference to the current view and load it if necessary.
  *
  * @param   string  $name    The view name. Optional, defaults to the controller name.
  * @param   string  $type    The view type. Optional.
  * @param   string  $prefix  The class prefix. Optional.
  * @param   array   $config  Configuration array for view. Optional.
  *
  * @return  JViewLegacy  Reference to the view or an error.
  *
  * @since   12.2
  * @throws  Exception
  */
 public function getView($name = '', $type = '', $prefix = '', $config = array())
 {
     // @note We use self so we only access stuff in this class rather than in all classes.
     if (!isset(self::$views)) {
         self::$views = array();
     }
     if (empty($name)) {
         $name = $this->getName();
     }
     if (empty($prefix)) {
         $prefix = $this->getName() . 'View';
     }
     if (empty(self::$views[$name][$type][$prefix])) {
         if ($view = $this->createView($name, $prefix, $type, $config)) {
             self::$views[$name][$type][$prefix] =& $view;
         } else {
             $response = 500;
             /*
              * With URL rewriting enabled on the server, all client requests for non-existent files are being
              * forwarded to Joomla.  Return a 404 response here and assume the client was requesting a non-existent
              * file for which there is no view type that matches the file's extension (the most likely scenario).
              */
             if (JFactory::getApplication()->get('sef_rewrite')) {
                 $response = 404;
             }
             throw new Exception(JText::sprintf('JLIB_APPLICATION_ERROR_VIEW_NOT_FOUND', $name, $type, $prefix), $response);
         }
     }
     return self::$views[$name][$type][$prefix];
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:43,代码来源:legacy.php


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