I was a little confused at first look of what Zend_Controller_Router_Route_Chain does so here's my 2 cents on explaining this feature.
I use Zend_Config_Xml so I will write my example as XML.
Say we have a URL like this: http://supercars.com/automobile/make-audi/model-r8/year-2011
that we want to route and we wanted to use the http://supercars.com/automobile as our base url.
Here is what we would do to implement router chaining on the above URL.
<routes>
<Automobile>
<type>Zend_Controller_Router_Route</type>
<route>automobile</route>
<defaults>
<controller>automobile</controller>
<action>index</action>
</defaults>
<chains>
<Make>
<type>Zend_Controller_Router_Route</type>
<route>make-:make</route>
<defaults>
<action>make</action>
</defaults>
<reqs>
<make>[\w]+</make>
</reqs>
<chains>
<Model>
<type>Zend_Controller_Router_Route</type>
<route>model-:model</route>
<defaults>
<action>model</action>
</defaults>
<reqs>
<model>[\w]+</model?
</reqs>
<chains>
<Year>
<type>Zend_Controller_Router_Route</type>
<route>year-:year</route>
<defaults>
<action>year</year>
</defaults>
<reqs>
<year>[\d]{4}</year>
</reqs>
</Year>
</chains>
</Model>
</chains>
</Make>
</chains>
</Automobile>
</routes>
Assuming we are only going to use controller Automobile.
Route name "Automobile-Make" correspond to URL:
http://supercars.com/automobile/make-Audi
Route name "Automobile-Make-Model" corresponds to URL:
http://supercars.com/automobile/make-Audi/Model-R8
Route name "Automobile-Make-Model-Year" corresponds to URL:
http://supercars.com/automobile/make-Audi/Model-R8/year-2011
You get the groove? Also notice the route tags inside the chains, it is only specific to specific URI for example: "make-:make" instead of rewriting the whole "route" to "automobile/make-:make" which is being appended. Also note that route "Automobile" will not exist here.
Another neat thing is you can create other routes on the same chain level so if you want to do something like: http://supercars.com/automobile/make-Audi/page-8 you declare a route the same as on the route "Model" level as you will see below.
<chains>
<Make>
<type>Zend_Controller_Router_Route</type>
<route>make-:make</route>
<defaults>
<action>make</action>
</defaults>
<reqs>
<make>[\w]+</make>
</reqs>
<chains>
<Page>
<type>Zend_Controller_Router_Route</type>
<route>page-:page</route>
<defaults>
<action>page</action>
</defaults>
<reqs>
<make>[\d]+</make>
</reqs>
</Page>
<Model>
<type>Zend_Controller_Router_Route</type>
<route>model-:model</route>
<defaults>
<action>model</action>
</defaults>
<reqs>
<model>[\w]+</model?
</reqs>
</Model>
</chains>
<Make>
</chains>
3 comments:
Sergei , October 22, 1970 Born in Christian Louboutin Bois Dore Moscow State Ozherelye. Perhaps influenced by Cheap LV Handbags their parents worship warrior army, join the army in cheap jordans 1989, and into the elite airborne military service. 1991, by the influence of the Soviet Union, the uggs on sale Russian christian louboutin army general lack of funds, a large number ugg australia of Air Jordan 11 Gamma Blue soldiers seeking veterans, but under extremely difficult conditions still dedicated, praise superiors, and soon was sent to the famous christian louboutin shoes Ryazan Higher ugg Airborne Command School studies. After graduating in 1994, entered the famous Pskov 76th Guards Airborne discount christian louboutin Division, served as discount nike jordans the reconnaissance platoon, reconnaissance ugg soldes deputy company commander, company commander, battalion airborne regiment scouting director and other duties.From 2000 to Cheap Louis Vuitton Handbags 2004, where the forces have repeatedly ordered war with Chechen militants. Because of their opponents in order to form the squad activity and haunted impermanence, the Russians had to ugg boots mobilize elite troops set up large uggs outlet number of small units, "a Discount Louis Vuitton small wholesale jordan shoes play small" Implementation siege. commanding troops in Chechnya, Christian Louboutin Daffodile Ingushetia and other places over the mountains, to track the militants fled. Discount LV Handbags Although the militants were extremely vigilant, but as long as the task has never had outsmarted.August 8, 2008, Georgia suddenly invade South Ossetia (Russian peacekeepers stationed ugg pas cher there), the Russian military to respond quickly, including including the 76th Guards Airborne Division, more than christian louboutin remise 50% 3,000 people were immediately delivered to the pro-Russian Abkhazia, Georgia cheap nike jordan shoes Army contain two infantry brigades, effectively coordinate the cheap christian louboutin direction of the Russian Bags Louis Vuitton troops in South Ossetia.
tory burch outlet, longchamp outlet, burberry, ray ban sunglasses, tiffany and co, nike outlet, replica watches, louis vuitton, ray ban sunglasses, nike air max, jordan shoes, polo ralph lauren outlet, michael kors outlet, tiffany jewelry, michael kors outlet, christian louboutin outlet, burberry outlet online, michael kors outlet, michael kors, oakley sunglasses, longchamp, prada outlet, prada handbags, cheap oakley sunglasses, oakley sunglasses, oakley sunglasses, ugg boots, louboutin shoes, michael kors outlet, ugg boots, polo ralph lauren outlet, louis vuitton outlet, nike free, chanel handbags, louboutin outlet, louis vuitton outlet, oakley sunglasses, ugg boots, replica watches, michael kors outlet, kate spade outlet, uggs on sale, nike air max, louboutin, louis vuitton, louis vuitton
moncler, moncler outlet, marc jacobs, moncler, hollister, montre pas cher, vans, ray ban, replica watches, pandora charms, louis vuitton, supra shoes, sac louis vuitton pas cher, pandora jewelry, swarovski, pandora charms, moncler, bottes ugg, barbour, canada goose, ugg,uggs,uggs canada, louis vuitton, doke gabbana outlet, converse, louis vuitton, lancel, louis vuitton, hollister, moncler, pandora jewelry, doudoune canada goose, juicy couture outlet, nike air max, converse outlet, barbour jackets, moncler, ugg,ugg australia,ugg italia, links of london, moncler, gucci, canada goose outlet, canada goose, canada goose outlet, coach outlet, canada goose uk, ugg boots uk, canada goose, juicy couture outlet, ugg pas cher, wedding dresses, canada goose
Post a Comment