简体   繁体   English

CakePHP控制器操作未呈现

[英]CakePHP Controller Action not Rendering

I have a CakePHP Action that is not rendering it's view, however the action is being executed. 我有一个CakePHP Action,它没有呈现它的视图,但是该操作正在执行。

I have the controller VoteTagsController with the action alltags() 我有带动作alltags()的控制器VoteTagsController

App::uses('AppController', 'Controller');

class VoteTagsController extends AppController {

    public function index(){
        $this->set('allVoteTags', $this->VoteTag->find('all'));
    }

    public function alltags(){
        echo "Running";
        echo "Test";        
    }     
}

The view exsists also in /View/VoteTags/alltags.ctp 该视图还存在于/View/VoteTags/alltags.ctp中

I am attempting to load the action from http://test_site.dev/votetags/alltags 我正在尝试从http://test_site.dev/votetags/alltags加载操作

I've tried everything but cannot get this view to render I just get a white page, no errors. 我已经尝试了所有方法,但无法获得此视图以呈现,我只得到了一个白页,没有错误。

Changing the name of the controller however and refreshing sends me to an Error Not Found page which indicates the action is being fired but not rendered. 但是,更改控制器的名称并刷新后,将我带到“未找到错误”页面,该页面指示操作已被触发但未呈现。

Any ideas? 有任何想法吗?

Based on conventions your URL should be test_site.dev/vote_tags/alltags If you wish to change this you can add to your app/Config/routes.php file the following line 根据约定,您的网址应为test_site.dev/vote_tags/alltags如果您希望更改此网址,则可以test_site.dev/vote_tags/alltags添加到app/Config/routes.php文件中

Router::connect('/votetags/alltags', array('controller' => 'vote_tags'))

Or whatever other url template you might like. 或您可能喜欢的任何其他url模板。 For more information read http://book.cakephp.org/2.0/en/development/routing.html 有关更多信息,请阅读http://book.cakephp.org/2.0/en/development/routing.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM