用户
 找回密码
 入住 CI 中国社区
搜索
查看: 3178|回复: 2
收起左侧

修改默认载入视图函数

[复制链接]
发表于 2012-2-14 13:33:23 | 显示全部楼层 |阅读模式
想修改$this->load->view()方法,使之实行载入不同的分类(如后台、前台、插件)分别载入不同的文件夹中的模板
当然你也可以说直接在application/view里面建立这些文件夹,不过我习惯在根目录里面建立这些

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

发表于 2012-2-14 13:35:41 | 显示全部楼层
是的 要扩展 loader.php 里的 view() 方法。
发表于 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));
        }

本版积分规则