![]() |
|
Snippets |
|
Let's take an example. You want to have the user culture in front of each of your URL.
So, your routing configuration look like something like that:
page: url: /:culture/:page params: ... article: url: /:culture/:year/:month/:day/:slug params: ... ...
This is the easy part. But now, every time you call url_for() or link_to() you have to pass the culture parameter.
For such situations, there is a better way. The routing has a special configuration parameter named sf_routing_defaults that you can set with default values:
sfConfig::set('sf_routing_defaults', array('culture' => 'en'));
And now, the culture parameter will automatically added to the parameters that you pass to the url_for() or link_to() helpers.