Re: [symfony-users] Re: SF 2 - Referrer object similar to Request object?

2011-05-11 Thread David Buchmann
-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

[symfony-users] Re: SF 2 - Referrer object similar to Request object?

2011-05-10 Thread theinterned
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)

Re: [symfony-users] Re: SF 2 - Referrer object similar to Request object?

2011-05-10 Thread David Buchmann
-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

[symfony-users] Re: SF 2 - Referrer object similar to Request object?

2011-05-10 Thread theinterned
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

[symfony-users] Re: SF 2 - Referrer object similar to Request object?

2011-05-10 Thread theinterned
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,

[symfony-users] Re: SF 2 - Referrer object similar to Request object?

2011-05-09 Thread theinterned
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.

Re: [symfony-users] Re: SF 2 - Referrer object similar to Request object?

2011-05-09 Thread Christophe COEVOET
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

[symfony-users] Re: SF 2 - Referrer object similar to Request object?

2011-05-09 Thread Matt
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