Monday, October 4, 2010

Re: "Sticky" URL parameters?

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 <zijn.digi...@gmail.com> wrote:
> It seems that you're describing making use of Session.

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: