Killersites Community: Dispatching Requests to Multiple Controllers Problem - Killersites Community

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Dispatching Requests to Multiple Controllers Problem

#1 User is offline   seamoh 

  • View blog
  • Group: New Members
  • Posts: 5
  • Joined: 09-June 11

Posted 12 June 2011 - 10:58 PM

Hello All:
in Killer php Advance php cc (17 videos) in Dispatching Requests to Multiple Controllers . John lebensold teach the follwing switch :
switch($uri)
{
case "/";
case "index";
$controller = new Controllers\IndexController();
break;
case "/test":
$controller = new Controllers\TestController();

break;

}

But I encounter a problem , when I tes http://killerphp or http://killerphp/test , the browser shows nothing , because it doesn't know to call dispatch() method in each controller , then I try to call each controller dispatch method as below :
switch($uri)
{
case "/";
case "index";
$controller = new Controllers\IndexController();
$controller->dispatch($uri);
break;
case "/test":
$controller = new Controllers\TestController();
$controller->dispatch($uri);
break;

}
then it works . and the controller works . Mr Jon Lebensold use the first switch .would you please discuss what is the problem
Sincerely yours
0

#2 Guest_phpNoob

  • Group: Guests

Posted 02 July 2011 - 02:48 PM

Anyone figured out the solution? I am still having this issue....
0

#3 User is offline   zoopstud 

  • View blog
  • Group: New Members
  • Posts: 1
  • Joined: 22-September 11

Posted 26 October 2011 - 08:03 AM

Old post I know but no one else commented on it, basically the line below is added after the switch but you cannot see it on the screen.

$controller->dispatch($uri);

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users