karam Posted May 5, 2012 Report Posted May 5, 2012 use \com\killerphp\controllers as Controllers; $uri = strtolower($_SERVER['REQUEST_URI']); list($pfx, $controllerName,$actionName) = preg_split('/[\/\\\]/',$uri); echo $uri; switch($controllerName) { case "": case "index": $controller = new Controllers\IndexController($controllerName,$actionName); break; case "test": $controller = new Controllers\TestController($controllerName,$actionName); break; } var_dump($controller); $controller->dispatch(); output is /public/ Notice: Undefined variable: controller in C:\xampp\htdocs\public\index.php on line 35 NULL Notice: Undefined variable: controller in C:\xampp\htdocs\public\index.php on line 36 Fatal error: Call to a member function dispatch() on a non-object in C:\xampp\htdocs\public\index.php on line 36 I 'm watching kp3-setting-up-htaccess-for-controllers this video and try to do myself in window 7 laptop . my question is i save C:\xampp\htdocs\public .htaccess and show output /public/ and also undefined variable controller ?? any body guide me to solve this problem then i move foward..... advance thankx Quote
iulian Posted October 27, 2012 Report Posted October 27, 2012 Same problem for me. When i add $controller->dispatch($uri) to index.php on "Dispatching request to multiple controllers lesson"; i get the same errors (Undefined variable $controller and Call to a member function dispatch() on a non-object in) Quote
mantis Posted September 1, 2013 Report Posted September 1, 2013 To prevent cross posting see post My link I have the same problem Regards mantis Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.