Jump to content

Everything To One Controller


chemdream

Recommended Posts

Freaks,

 

My goal is trying to edit the code below so, no matter what, everything gets sent to the Index controller:

so, for example:

 

http://domain.tld/page would go to the Index Controller, and call the pageAction method.

 

right now, that would get sent to the page controller...

 

Yaf_Dispatcher::getInstance()->getRouter()->addRoute(
         "pages", new Yaf_Route_Regex(
         "#^/index/page/(\d+)#",
         array('controller' => "Index"),
         array(1 => "page")
                 )
                );

 

I'm horrible with regular expressions. I'm pretty sure I could just edit #^/index/page/(\d+)# (and remove the 2nd part of the array) and it will just work. Any help would be greatly appreciated!

 

There is a bit of info here about it: http://php.net/manual/en/yaf-route-rewrite.construct.php

 

THANK YOU!

Link to comment
Share on other sites

I would create your own Route object. There is no need to use the Yaf_Route_Regex Route if your simply going to map everything to a single controller anyway.

 

Sorry, I'm not sure what you mean. heh. Do you think you could give an example or a link to an example? The YAF documents aren't complete so I'm feel like I'm flying a bit blind. heh.

Link to comment
Share on other sites

Sorry, I'm not sure what you mean. heh. Do you think you could give an example or a link to an example? The YAF documents aren't complete so I'm feel like I'm flying a bit blind. heh.

 

I should also mention that I'm using YAF for MVC... Only for this one project do I need everything to go through one controller. But still need YAF to take care of the layout, views and other stuff.

 

Thanks!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.