properly use of languages in zend framework

前端 未结 2 1299
隐瞒了意图╮
隐瞒了意图╮ 2021-02-06 13:56

I have an Zend application with two modules (admin and public) and for public I have the following plugin to parse my friendly-url:

class Custom_Controller_Plugi         


        
2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-06 14:39

    I'd say that you should use custom router. This is what router is for - determining parameters from URI. Now you just let the router do work for no reason. Because you then change the result of it's work.

    Writing custom router is not that difficult and I would suggest you should do so. You can write there something like:

    1. explode by /
    2. is first part "en", "de" or "es", if so set lang = $arr[0]
    3. work as default route for Zend_Router

    And you can add many more options. Also matching may be much faster because you can logically strucutre the URI decomposition. Normal router is dumb - it just matches URI to route regex and stops when match is found.

提交回复
热议问题