I did it this way, but I would change to the form view helpers and code everything a little different:

<form action="{$thispage}">
<input type="image" src="/img/de.gif" alt="de"/>
<input type="hidden" value="de" id="de" name="lang"/>
</form>

<form action="{$thispage}">
<input type="image" src="/img/en.gif" alt="en"/>
<input type="hidden" value="en" id="en" name="lang"/>
</form>

inside:
My_Controller_Action extends Zend_Controller_Action
in the init() I am doing this:
if($this->_request->getPost('lang')){
$this->view->lang = $_SESSION['lang'] = $this->_request->getPost('lang');
        }
        if(empty($_SESSION['lang'])){
            $this->lang = $_SESSION['lang'] = 'de';
        }
        $this->lang = $this->view->lang = $_SESSION['lang'];

This way I can change the language and stay on the same site when switching




> Hi all,
> I have a problem:
> I have to develop an Action that have to set a session variable ( switch of > language ) and return exactly in the action from where it was called.. With
> parameters too..
> For example.. suppose we are in a page being called:
> www.domain.ext/controller/action?param=value&param=value
>
> So we click on a flag trying change the language. An Action
> ChangelanguageAction will be called.. inside this Action i want to set a variable and to return to the previous
> Action..
>
> Any Idea?
>
> Waiting help from all you..
>
> Best Regards to all and very compliments for all..
>
> Mauro Casula.



Mauro Casula schrieb:
Hi all,
I have a problem:
I have to develop an Action that have to set a session variable ( switch of
language  ) and return exactly in the action from where it was called.. With
parameters too.. For example.. suppose we are in a page being called:
www.domain.ext/controller/action?param=value&param=value

So we click on a flag trying change the language. An Action
ChangelanguageAction will be called.. inside this Action i want to set a variable and to return to the previous
Action..

Any Idea?

Waiting help from all you..

Best Regards to all and very compliments for all..

Mauro Casula.

Reply via email to