mvc999 发表于 2011-7-19 16:29:54

jeongee 发表于 2011-7-19 16:26 static/image/common/back.gif
我刚试了,确实是可以的。
原因应该是你没有写 构造函数,或者没有调用父类的构造函数,是要这样的
funct ...

这个是我的代码
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends Front_Controller{
        /**
       * Index Page for this controller.
       *
       * Maps to the following URL
       *                 http://example.com/index.php/welcome
       *        - or -
       *                 http://example.com/index.php/welcome/index
       *        - or -
       * Since this controller is set as the default controller in
       * config/routes.php, it's displayed at http://example.com/
       *
       * So any other public methods not prefixed with an underscore will
       * map to /index.php/welcome/<method_name>
       * @see http://codeigniter.com/user_guide/general/urls.html
       */
        function __construct()
        {
                parent::__construct();       
        }
        public function index()
        {
                $this->_template('welcome_message');
        }

        public function qt(){

                $this->_template('aa');


       
        }
}

jeongee 发表于 2011-7-19 16:38:44

本帖最后由 jeongee 于 2011-7-19 16:40 编辑

mvc999 发表于 2011-7-19 16:29 static/image/common/back.gif
这个是我的代码
我算是听明白你的问题所在了哈,是你对_template函数理解错误造成的,这个纯属我个人开发喜号用的,因为我会建个文件叫default.php,然后这里面load->view('header');footer等,如果你要用的话就再读以下那个函数的代码,或者就还是用$this->load->view来加载视图吧,嘿嘿

function _template($template, $data = array())
                {
                        $data['tpl'] = $template;
                        $this->load->view('default',$data);
                }



每次都是请求default.php视图文件的,default.php一般的结构就是

$this->load->view('header');

$this->load->view($tpl);
$this->load->view('footer');

mvc999 发表于 2011-7-19 16:41:54

jeongee 发表于 2011-7-19 16:38 static/image/common/back.gif
我算是听明白你的问题所在了哈,是你对_template函数理解错误造成的,这个纯属我个人开发喜号用的,因为我 ...

哦明白了,谢谢在百忙之中解答,呵呵!

as3291363 发表于 2011-7-19 17:02:54

我不明白這個項目的用處是幹什麼的?
前臺也看不到呢?

具體是幹什麼的呢?不太像cms...

jeongee 发表于 2011-7-19 17:04:59

本帖最后由 jeongee 于 2011-7-19 17:05 编辑

as3291363 发表于 2011-7-19 17:02 static/image/common/back.gif
我不明白這個項目的用處是幹什麼的?
前臺也看不到呢?


呵呵,不要以为非得有前台才能叫cms啊,cms 内容管理系统。

要说干什么的嘛,方便用的,用的着的同学自然可以晓得其用处,用不到的自然也就不晓得啦,哈哈

as3291363 发表于 2011-7-19 17:07:58

是..我是很想學習下那個代碼的精髓...
之前的那個stblog 讓我受益匪淺...
但是這個 我只能看懂代碼 ,以後有套用的重複的代碼的時候我可以自己copy一下.

依然、 发表于 2011-7-19 20:06:06

貌似我的问题依然存在

Erric_Zhu 发表于 2011-7-26 22:01:24

牛人,顶一个!!!

guanliyang 发表于 2011-7-27 12:34:12

升级到是快啊

jeongee 发表于 2011-7-27 13:04:43

guanliyang 发表于 2011-7-27 12:34 static/image/common/back.gif
升级到是快啊

额,这帖子发了好久啦
页: 1 [2] 3 4
查看完整版本: DiliCMSV1.0更新至beta2啦~~~