|
|||
|
Hi, I'm having a lot of trouble routing requests to modules.
I've set up an XML config file containing my routes (below), and I load it into the router in my bootstrap (also below). I have two routes: a default route, which just goes to Default/IndexController->indexAction, and a projects route, which is supposed to go to Projects/Project_IndexController->indexAction. (I'm using Default/ and Projects/ here to signify modules) The problem is, I can't browse to url/projects - I just get taken to the default controller. My front controller is successfully loading the paths for each of these modules (also in an XML file), so that is not an issue. I've tried reversing the order of my routes, just in case, but without success. Setting the module property of the default route to "projects" successfully redirects to the project controller. What is going on? routes.xml: Code:
<?xml version="1.0" encoding="UTF-8"?>
<routes>
<production>
</production>
<staging extends="production">
<routes>
<default>
<route></route>
<defaults>
<module>default</module>
<controller>index</controller>
<action>index</action>
</defaults>
</default>
<projects_index>
<route>projects/</route>
<defaults>
<module>projects</module>
<controller>index</controller>
<action>index</action>
</defaults>
</projects_index>
</routes>
</staging>
</routes>
Bootstrap: (index.php) PHP Code:
Code:
array(2) {
["default"]=>
object(Zend_Controller_Router_Route)#19 (11) {
["_urlVariable:protected"]=>
string(1) ":"
["_urlDelimiter:protected"]=>
string(1) "/"
["_regexDelimiter:protected"]=>
string(1) "#"
["_defaultRegex:protected"]=>
NULL
["_parts:protected"]=>
NULL
["_defaults:protected"]=>
array(3) {
["module"]=>
string(7) "default"
["controller"]=>
string(5) "index"
["action"]=>
string(5) "index"
}
["_requirements:protected"]=>
array(0) {
}
["_staticCount:protected"]=>
int(0)
["_vars:protected"]=>
array(0) {
}
["_params:protected"]=>
array(0) {
}
["_values:protected"]=>
array(0) {
}
}
["projects_index"]=>
object(Zend_Controller_Router_Route)#15 (11) {
["_urlVariable:protected"]=>
string(1) ":"
["_urlDelimiter:protected"]=>
string(1) "/"
["_regexDelimiter:protected"]=>
string(1) "#"
["_defaultRegex:protected"]=>
NULL
["_parts:protected"]=>
array(1) {
[0]=>
array(1) {
["regex"]=>
string(8) "projects"
}
}
["_defaults:protected"]=>
array(3) {
["module"]=>
string(8) "projects"
["controller"]=>
string(5) "index"
["action"]=>
string(5) "index"
}
["_requirements:protected"]=>
array(0) {
}
["_staticCount:protected"]=>
int(1)
["_vars:protected"]=>
array(0) {
}
["_params:protected"]=>
array(0) {
}
["_values:protected"]=>
array(0) {
}
}
}
Will. |
|
||||
|
Both of the routes you set are messing up the routing process. There is a 'default' route in the router by default which should not be overridden unless you are hacking the router
![]() By default ZF will route to the url's you specified. /<moduleName> / -> default/index/index
__________________
Zym Framework - A Zend Framework extension library w/ demo app SpotSec Blog: http://spotsec.com/blog |
|
||||
|
Strange.... you do have mod_rewrite setup right?
__________________
Zym Framework - A Zend Framework extension library w/ demo app SpotSec Blog: http://spotsec.com/blog |
![]() |
| Thread Tools | |
| Display Modes | |
|
|