-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
hi,
hm, yes i think this is what i thought. we did it that way but we have
extremly few routes in our project.
on the view layer, its easy as we just wrote a small snipped for that
element that is included in the base layout.
maybe somebody else
I solved this.
I found the $router-match() method, which I am using against a
cleaned up version of the $request-server-get('HTTP_REFERER'). This
gives me the route parameters I need to generate my redirect route.
Here is the completed action:
public function switchLangAction($_locale)
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
hi
i think you should generate the current route with all locales you
support and directly use those to switch the language, instead of having
the client send a request and then redirecting.
as a side note, instead of the string replacement, you
Thanks for the pointing out the parse_url function David; I felt
pretty iffy about all that string replacement. This is much cleaner
(and is a great function to know!)
I still had to strip the controller out as a seperate step, but that
is cool. The new action looks like:
public function
On the other point: I am not sure what you mean by your suggestion - I
you suggesting that every controller action pass down a 'switched url'
of itself to be rendered by the view? That seems like a lot to
maintain. I am new to Symfony 2; maybe there is an elegant way to
achieve this?
On May 10,
Sorry - I am looking for a Referrer object - similar to the Request
object.
I believe my sample code included an example of retrieving request
params... I was hoping I would have a similar object for the referrer.
Alternately, I was asking if there was another way to do what I am
trying to do.
Le 09/05/2011 18:50, theinterned a écrit :
Sorry - I am looking for a Referrer object - similar to the Request
object.
I believe my sample code included an example of retrieving request
params... I was hoping I would have a similar object for the referrer.
Alternately, I was asking if there
Hi,
This is how I did it:
public function changeLocaleAction($locale)
{
if ($this-request-hasSession())
$this-session-setLocale($locale);
$referer = $this-request-server-get('HTTP_REFERER');
if (!isset($referer))
$referer = $this-generateUrl('index');
return new