Jump to content

Chapter 4 - public function dispatch()


cbcram

Recommended Posts

Hi,

 

I'm watching the chapter 4 of Advance PHP. I've got a problem. When I create a new class controller (i.e. IndexController) the public function dispatch() doesn't do anything. In the video class it works fine. It seems that this function is executed automatically when the class is created, isn't it? And why doesn't it works in my computer?

 

I'm using PHP Version 5.3.3-7+squeeze1 on Apache 2.2.

 

I also take to ask how the dispatch function uses the uri parameter, which is never passed to the class neither to the function?

 

Thanks, for your attention and for the videos -they are really great!!.

 

Marc

Link to comment
Share on other sites

I haven't yet watched the advanced PHP videos, so I'm not sure how helpful I'll be able to be. However, if you post the code you are working with (or, if you need to, compress all of your files into a .zip archive and post a link to it/upload it to your post) I may be able to help.

 

Have you downloaded the source files for the videos and compared your files against the source files?

Link to comment
Share on other sites

Solved!!!

 

Sorry it was my fault. In my video doesn't appear the last line of the index.php (public function) so I missed to include $controller->dispatch($uri). There's no problem, dispatch isn't a phantom function, and the recived parameters are passed to it in normal way. I've seen in the solution in chapter 5, where the missing line in chapter 4 appears.

 

Sorry to all to make spend your time, and thank you all.

 

Marc

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...