轻翼逐月 发表于 2012-2-14 13:33:23

修改默认载入视图函数

想修改$this->load->view()方法,使之实行载入不同的分类(如后台、前台、插件)分别载入不同的文件夹中的模板
当然你也可以说直接在application/view里面建立这些文件夹,不过我习惯在根目录里面建立这些

是在application/core里面重写Loader类的view方法么?

Hex 发表于 2012-2-14 13:35:41

是的 要扩展 loader.php 里的 view() 方法。

feizhoulv 发表于 2012-7-2 12:57:57

        /**
       * Load View
       *
       * This function is used to load a "view" file.It has three parameters:
       *
       * 1. The name of the "view" file to be included.
       * 2. An associative array of data to be extracted for use in the view.
       * 3. TRUE/FALSE - whether to return the data or load it.In
       * some cases it's advantageous to be able to return data so that
       * a developer can process it in some way.
       *
       * @param        string
       * @param        array
       * @param        bool
       * @return        void
       */
        public function view($view, $vars = array(), $return = FALSE)
        {
                return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));
        }
页: [1]
查看完整版本: 修改默认载入视图函数