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
https://forums.phpfreaks.com/topic/269087-everything-to-one-controller/
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.

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.