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
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)
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
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now