CrimpJiggler Posted January 2, 2014 Share Posted January 2, 2014 I created two tables: CREATE TABLE `comments` ( `id` int(11) unsigned NOT NULL auto_increment, `name` varchar(100) default NULL, `content` text, `post_id` int(11) default NULL, PRIMARY KEY (`id`) ); CREATE TABLE `users` ( `id` int(11) unsigned NOT NULL auto_increment, `name` varchar(100) default NULL, `email` varchar(150) default NULL, `firstname` varchar(60) default NULL, `lastname` varchar(60) default NULL, PRIMARY KEY (`id`) ); then added a model and controller file for each of them. <?php class Comment extends AppModel { var $name = 'Comment'; public $BelongsTo = array( 'Solution' => array('className' => 'Solution'), 'Visitor' => array('className' => 'Visitor') ); } ?> then added CommentsFolder: <?php class CommentsController extends AppController { var $name = 'Comments'; var $scaffold; public $helpers = array('Html', 'Form', 'Session','Text','FieldDisplay','Js'=>array("Jquery")); } <?php class Visitor extends AppModel { var $name = 'Visitor'; var $hasMany = array( 'Solution' => array('className' => 'Solution'), 'Comment' => array('className' => 'Comment') ); } ?> <? class VisitorsController extends AppController { var $name = 'Visitors'; var $scaffold; public $helpers = array('Html', 'Form', 'Session','Text','FieldDisplay','Js'=>array("Jquery")); } ?> The comments page works fine: but on the visitor page it says it can't find the controller: It makes no sense at all. I checked file permissions and all permissions in the Controller folder are identical. I found another thread about this problem and someone told the OP to add pr(App::path("controllers")); to webroot/index.ctp and the person found the problem that way, but in my case they are identical. I've tried changing the URL to lowercase. I can probably just make a new table and rename it to Visitors but I'd prefer to understand whats gone here incase it happens again. Link to comment https://forums.phpfreaks.com/topic/285040-cakephp-says-my-controller-doesnt-exist-but-it-actually-does/ Share on other sites More sharing options...
gristoi Posted January 2, 2014 Share Posted January 2, 2014 your opemning tag in vistors controller: <? class should be <?php class also check the filename does not have a typo Link to comment https://forums.phpfreaks.com/topic/285040-cakephp-says-my-controller-doesnt-exist-but-it-actually-does/#findComment-1463606 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.