Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-17-2007, 06:04 PM
Junior Member
 
Join Date: Aug 2007
Posts: 2
Default in which file u place routing rules

hi

im novice to zend_framework. im little confused about placing some special parts of code..

i know what code should i place to controllers, i know what code should i place to models, but there is still code i have no idea where to place

for example routing rules.. now im placing it to index.php - bootstrap. it is no problem, but i think the bootstrap is getting little messy.

so where do u place these rules??
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 09-16-2007, 10:24 PM
Junior Member
 
Join Date: Sep 2007
Posts: 2
Default

Hi,

I place it into a config file. The rewrite router even has special support for it:

PHP Code:
$objRouter = new Zend_Controller_Router_Rewrite();
$objConfig = new Zend_Config_Ini('config.ini''someSection');
$objRouter->addConfig($objConfig'routes'); 
The config.ini can look like this:

Code:
routes.archive.route = "archive/:year/*"
routes.archive.defaults.controller = archive
routes.archive.defaults.action = show
routes.archive.defaults.year = 2000
routes.archive.reqs.year = "\d+"

routes.news.type = "Zend_Controller_Router_Route_Static"
routes.news.route = "news"
routes.news.defaults.controller = "news"
routes.news.defaults.action = "list"

routes.archive.type = "Zend_Controller_Router_Route_Regex"
routes.archive.route = "archive/(\d+)"
routes.archive.defaults.controller = "archive"
routes.archive.defaults.action = "show"
routes.archive.map.1 = "year"
; OR: routes.archive.map.year = 1
See Zend Framework: Documentation
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:08 PM.