On Tue, Oct 5, 2010 at 2:17 AM, O.J. Tibi <[email protected]> wrote:
> Storing the country code in the session be part of the solution, yes,
> but is there a good way to "persist" this country code parameter as
> part of the URL too?
>
> If I was on a certain French page, where "fr" is the country code,
> let's say:
>
> http://www.example.com/fr/users/view/123
>
> then I would like to write my code in the view like so:
>
> echo $html->link('Edit', array('controller' => 'users', 'action' =>
> 'edit', 123));
>
> as opposed to:
>
> echo $html->link('Edit', array('controller' => 'users', 'action' =>
> 'edit', 123, 'country' => 'fr'));
>
> which maps to a route rule that matches the url above.
>
> The solution needs to work with Controller::redirect() and
> Router::url() as well, if that's possible. It will take a lot less
> effort writing URLs without adding the country parameter each time.
> It's quite similar to the built-in admin routing mechanism, with the
> following differences.
>
> * The actions do not need an actual prefix in their method names (you
> don't need to declare an fr_edit() to view a French edit page.
> * The value of the prefix (country) is dynamic, as opposed to admin
> routing (which is always "admin")
>
> On Oct 4, 10:24 pm, cricket <[email protected]> wrote:
>> It seems that you're describing making use of Session.

You could create AppController::redirect() in which you check for a
'country' option and add it if it doesn't exist. Then pass the
parameters to parent::redirect().

For HtmlHelper::link() you could create AppHelper::url(). Do the same,
passing the params to parent::url().

I think.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to