2009年10月9日星期五

[fw-mvc] Zend Controller Router with DB Lookup

Hi all,

Please could somebody tell me again why creating a router with database look up is a bad idea. Cause i find a case where i need my router to look into database to determine the correct module, controller and action for the request.

Let's say i have an article module, and i want these urls to map to a certain entry of my article table:

http://www.example.com/about-us  => Article_ArticleController::indexAction (alias='about-us')
http://www.example.com/featured-products  => Article_ArticleController::indexAction (alias='featured-products')
http://www.example.com/contact-us  => Article_ArticleController::indexAction (alias='contact-us')

but i also want these urls to map into my news module, forum module and gallery module respectively:

http://www.example.com/news  => News_NewsController::indexAction
http://www.example.com/forum  => Forum_ForumController::indexAction
http://www.example.com/gallery  => Gallery_GalleryController::indexAction


how can we determine this without having to check in to database, and see whether the path (alias) exists in article table or not?


regards,
eris

没有评论: