我在Zend-Router上苦苦掙扎。我想在我的網址中鏈接語言。一切正常,但我的模塊化路由。支持Zend和多語言支持的路由問題模塊化應用
如果我打電話:http://domain.de/en/index
- 我的IndexController的默認模塊的indexAction被執行和翻譯。
同樣如下: http://domain.de/en/about
所以調用IndexController的aboutAction。
如果我打電話給:http://domain.de/en/forum/index
它應該執行論壇模塊的IndexController的indexAction。但事實並非如此。
我的目標是儘可能縮短我的網址,因此它沒有「默認」或「索引」。
你能幫我編輯我的routes.xml,所以我得到想要的結果嗎?
我routes.xml
<config>
<routes>
<sc1 type="Zend_Controller_Router_Route">
<route>:lang/:@module/:@controller/:@action</route>
<defaults>
<lang>de</lang>
<module>default</module>
<controller>index</controller>
<action>index</action>
</defaults>
</sc1>
<sc2 type="Zend_Controller_Router_Route">
<route>:lang/:@module/:@action</route>
<defaults>
<lang>de</lang>
<module>default</module>
<controller>index</controller>
<action>index</action>
</defaults>
</sc2>
<sc3 type="Zend_Controller_Router_Route">
<route>:lang/:@controller/:@action</route>
<defaults>
<lang>de</lang>
<module>default</module>
<controller>index</controller>
<action>index</action>
</defaults>
</sc3>
<sc4 type="Zend_Controller_Router_Route">
<route>:lang/:@action</route>
<defaults>
<lang>de</lang>
<module>default</module>
<controller>index</controller>
<action>index</action>
</defaults>
</sc4>
</routes>
</config>
你有一個愛迪?
謝謝你在前進, 托比亞斯
但是,還有沒有更好的辦法比手動聲明一切? 我的意思是模塊化路線工作得很好。只有當我想要鏈接語言時,我的模塊纔不再可用。 – 2010-09-22 19:32:33
不是我所知道的。如果你能測試/發現它,我會有興趣知道。我能看到的唯一方法是在聲明中使用變量IE:' @:module '但我非常懷疑這是可能的。 –
2010-09-22 19:34:51