Thanks very much, you were right!
A new question based on the first one.
- I would like that www.john.mydomain.com/all list all pages of john´s
profile.
- I would like that www.john.mydomain.com/1 list page one of john´s
profile.
www.john.mydomain.com/1 (or 2, 3, 4...) is done and working, but
www.john.mydomain.com/all is not going to the right action... it is going
for the action "view" instead of "allpages" action.
*I have two routes, route4 and route5 below:*
$route4 = new Zend_Controller_Router_Route_Hostname(
':username.mydomain.com',
array('module' => 'default'),
array('username' => '([a-z0-9]+)')
);
$route4action = new Zend_Controller_Router_Route(
':page',
array(
'controller' => 'profile',
'action' => 'view',
'page' => '([a-z0-9]+)'
)
);
//--------------------------------------------------------
$route5 = new Zend_Controller_Router_Route_Hostname(
':username.mydomain.com',
array('module' => 'default'),
array('username' => '([a-z0-9]+)')
);
$route5action = new Zend_Controller_Router_Route(
'/all',
array(
'controller' => 'profile',
'action' => 'allpages'
)
);
// Add routes
$router->addRoute('route5', $route5->chain($route5action));
$router->addRoute('route4', $route4->chain($route4action));
Regards!
2009/4/24 Ben Scholzen 'DASPRiD' <[email protected]>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> A hostname route is just there to match a hostname, not a path. See the
> (1.8) documentation about the ChainRoute.
> ...................................
> : ___ _ ___ ___ ___ _ ___ :
> : | \ /_\ / __| _ \ _ (_) \ :
> : | |) / _ \\__ \ _/ / | |) | :
> : |___/_/:\_\___/_| |_|_\_|___/ :
> :........:........................:
> : Web : http://www.dasprids.de :
> : E-mail : [email protected] :
> : Jabber : [email protected] :
> : ICQ : 105677955 :
> :........:........................:
>
>
> José de Menezes Soares Neto schrieb:
> > Hello my friends.
> >
> > I have a little problem with zend route, but I am sure you will help me,
> > let me explain...
> >
> > *My application without route:*
> >
> >
> http://www.mydomain.com/onemodule/onecontroller/oneaction/variable1/value1/variable2/value2
> >
> > Works fine!
> >
> > *My application with route:*
> >
> > http://www.value1.mydomain.com/ <http://mydomain.com/>value2
> >
> > Gives me an error (see below).
> >
> > *The route code I used:*
> >
> > // Host routes
> >
> > $hostUrl = new Zend_Controller_Router_Route_Hostname(
> > 'www.:variable1.mydomain.com/ <http://mydomain.com/>:variable2',
> > array('module' => 'onemodule'),
> > array('variable1' => '([a-z0-9]+)'),
> > array('variable2' => '([a-z0-9]+)')
> > );
> >
> > // Module routes
> >
> >
> > $router->addRoute('hostUrl', $hostUrl->chain(
> > new Zend_Controller_Router_Route_Static(
> > '',
> > array(
> > 'controller' => 'onecontroller',
> > 'action' => 'oneaction'
> > )
> > )
> > ));
> >
> > *Error message I am getting:*
> >
> > Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception'
> > with message 'Invalid controller specified (value2)'
> >
> > Regards,
> >
> > José
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAknyCRcACgkQ0HfT5Ws789DsfwCgpQaH8PgOp5na0rrcXoCns2E/
> pZkAoLs4YyW/EQ7PwooQed3v1W5dKnVU
> =fIAk
> -----END PGP SIGNATURE-----
>