小白想用cms二次開發,可是,為什麼我在Application下複製了一份然後改名,網頁url各種都試了就是不顯示,後來一直調試,發現跳到這最後一步 $this->display('pro/index'); 它就顯示沒找到,我用可以顯示的其它控制器裡面的$this->display也不顯示啊。。。。。。。這是為啥呢?
回複討論(解決方案)
最新版本嗎,去對應的檔案夾下View/pro/index.html那
最新版本嗎,去對應的檔案夾下View/pro/index.html那
3.2.2的,這是基於thinkphp的cms,我在想是不是cms本身有什麼設定檔沒有設定,因為其它本身的 控制器都可以使用的。
對tp熟悉嗎?最好瞭解tp本身的架構,不管那個CMS碰到什麼問題都可以搞定
僅僅複製一個分組,說不準哪有BUG
對tp熟悉嗎?最好瞭解tp本身的架構,不管那個CMS碰到什麼問題都可以搞定
僅僅複製一個分組,說不準哪有BUG
會點yii,沒看過tp,這兩天就在弄,然後就發現問題了。。。
最新版本嗎,去對應的檔案夾下View/pro/index.html那
我還比對了其它的控制器,傳入傳出的值什麼都是一樣的,就是輸出模板的時候不行了。直接跳404。。。。。。。
發一下報錯的控制器吧...
不過我個人建議你把時間分配在學習thinkphp上,不然後面再有其他問題也不好辦
發一下報錯的控制器吧...
不過我個人建議你把時間分配在學習thinkphp上,不然後面再有其他問題也不好辦
複製的控制器:
namespace Ra\Controller;
use Think\Controller;
class IndexController extends Controller {
public function index($page=1){
if(!is_numeric($page)) {
$this->error('參數錯誤');
}
if($_GET['keyword']) {
$where['content'] = array('like', "%{$_GET['keyword']}%");
$where['title'] = array('like',"%{$_GET['keyword']}%");
$where['_logic'] = 'or';
$condition['_complex'] = $where;
$condition['type'] = 'pro';
$this->page = M('page')->where($condition)->order('id desc')->page($page,mc_option('page_size'))->select();
$count = M('page')->where($condition)->count();
$this->assign('count',$count);
$this->assign('page_now',$page);
$this->display('Ra/index');
} else {
$condition['type'] = 'pro';
$this->page = M('page')->where($condition)->order('id desc')->page($page,mc_option('page_size'))->select();
$count = M('page')->where($condition)->count();
$this->assign('count',$count);
$this->assign('page_now',$page);
$this->theme(mc_option('theme'))->$this->display('Ra/index');
};
}
原件:
namespace Pro\Controller;
use Think\Controller;
class IndexController extends Controller {
public function index($page=1){
if(!is_numeric($page)) {
$this->error('參數錯誤');
}
if($_GET['keyword']) {
$where['content'] = array('like', "%{$_GET['keyword']}%");
$where['title'] = array('like',"%{$_GET['keyword']}%");
$where['_logic'] = 'or';
$condition['_complex'] = $where;
$condition['type'] = 'pro';
$this->page = M('page')->where($condition)->order('id desc')->page($page,mc_option('page_size'))->select();
$count = M('page')->where($condition)->count();
$this->assign('count',$count);
$this->assign('page_now',$page);
$this->display('pro/index');
} else {
$condition['type'] = 'pro';
$this->page = M('page')->where($condition)->order('id desc')->page($page,mc_option('page_size'))->select();
$count = M('page')->where($condition)->count();
$this->assign('count',$count);
$this->assign('page_now',$page);
$this->theme(mc_option('theme'))->display('pro/index');
};
}
調試到最後一步的時候就顯示404;到$this->theme(mc_option('theme'))這個值還是一樣的。就是display輸出不行,即使改成原件的也不行
我就粘貼了index的。
$this->theme(mc_option('theme'))->$this->display('Ra/index');
$this->theme(mc_option('theme'))->display('pro/index');
你看
我就粘貼了index的。
呃,不是的,我之前是分開了為了調試,$this->theme(mc_option('theme')); $this->display('Ra/index');然後為了讓你看的一樣我刪除回去沒整好.我是直接複製原件了的。
弄了個test.php 輸出的模板貌似有問題。。。。。。估計參數沒有對上才會跳轉404。我再查查、