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:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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

iD8DBQFIvR/x0HfT5Ws789ARAngNAJ9AujcgQap5wnOWwnX1+gFAxb9E1ACdHRGk
eXZLP2RS8OIovJbwt5CZIug=
=8haj
-----END PGP SIGNATURE-----


Reply via email to