-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Tom,
I'm currently quite busy, if you can't wait, just take a look at the unit tests of the chain and hostname route. They are mostly self-explaining. Regards, Ben Tom Graham schrieb: > Could you give an example of how the hostname router currently works? > > Thanks, > > Tom > > On 2 Sep 2008, at 12:13, Ben Scholzen 'DASPRiD' wrote: > > I have to tell, that the documentation was not updated yet by Martel nor > me, which means that is reflects the hostname routing, which was in > 1.6 RC1. > > Matthew Weier O'Phinney schrieb: >>>> -- Tom Graham <[EMAIL PROTECTED]> wrote >>>> (on Tuesday, 02 September 2008, 07:18 AM +0100): >>>>> I am writing a custom default router where by the module is >>>>> dependent on >>>>> the sub-domain, for example: >>>>> >>>>> domain.com -> default >>>>> www.domain.com -> default >>>>> admin.domain.com -> admin >>>>> anything-else.domain.com -> account >>>>> >>>>> The theory behind this is similar to the following in rails: >>>>> http://wiki.rubyonrails.org/rails/pages/HowToUseSubdomainsAsAccountKeys >>>>> >>>>> My router is based on Zend_Controller_Router_Route_Module, however >>>>> adding the route in my bootstrap class it is always NULL. >>>> >>>> There is now special hostname-based routing available with the 1.6.0 >>>> series: >>>> >>>> >>>> http://framework.zend.com/manual/en/zend.controller.router.html#zend.controller.router.routes.standard.hostname-routing >>>> >>>> >>>> I'd check that option out, personally. :) >>>> >>>> >>>>> $dispatcher = $this->_controller->getDispatcher(); >>>>> $request = $this->_controller->getRequest(); >>>>> $router = $this->_controller->getRouter(); >>>>> $router->addRoute('default', new >>>>> App_Controller_Router_Route_AccountKey(array(), $dispatcher, >>>>> $request)); >>>>> >>>>> I have managed to solve the problem by instantiating a request object >>>>> and assigning it to the front-controller as well as passing it to the >>>>> route. >>>>> >>>>> $dispatcher = $this->_controller->getDispatcher(); >>>>> $request = new Zend_Controller_Request_Http(); >>>>> $this->_controller->setRequest($request); >>>>> $router = $this->_controller->getRouter(); >>>>> $router->addRoute('default', new >>>>> App_Controller_Router_Route_AccountKey(array(), $dispatcher, >>>>> $request)); >>>>> >>>>> Is this my only option and is it the right one? My router seems to work >>>>> well other than this but I would be interested to hear about any other >>>>> custom routers people have written that do the same job. >>>>> >>>>> Thanks, >>>>> >>>>> Tom >>>>> >>>> > >> - -- ................................... : ___ _ ___ ___ ___ _ ___ : : | \ /_\ / __| _ \ _ (_) \ : : | |) / _ \\__ \ _/ / | |) | : : |___/_/:\_\___/_| |_|_\_|___/ : :........:........................: : Web : http://www.dasprids.de : : E-mail : [EMAIL PROTECTED] : : Jabber : [EMAIL PROTECTED] : : ICQ : 105677955 : :........:........................: -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFIvbWm0HfT5Ws789ARArKBAKCuIqIoNx7+q0GhPedrN4vESbxqawCeK0RW ynb5wQfzK/LAxJYtZuBIaNw= =zw5+ -----END PGP SIGNATURE-----
