views:

169

answers:

3

Hi, i'm studying zend. Now i have the following idea: i have a page users/index that contains all users and users/view/id/5 that shows info. Also i want to make some kind of rating users. That means, that user can click smth like user/rulez/id/5 and give a vote to user#5 and that must be redirected to page user/index(or user/view/id/5) depending on place, he'd voted.

I've read about _helper->redirector but still can't think of a method, that could take me to required page.

A: 

I'm not sure if I fully understand your question, but from the action that invokes your voting method, you could simply:

$this->_redirect('/user/index');
karim79
ok, i think, my explanation is rather complicated.user can vote on page user/index by clicking "vote" near user's nameuser can vote on page user/view/id/5 by clickin "vote".Both of this ways are handled by user/vote/id/5. It has some logic(updating DB), and than user should be redirected to the page, where he was before (user/index or user/view/id/5). How can i get information, where he was, and add some text like "Tnx for voting"?
flufferok
A: 

"How can i get information, where he was" I think that here you can find the anwser for your question.

Marcin
tnx, but i don't want to use hidden elements as long as i don't use forms
flufferok
And what about keeping this info in a session?
Marcin
do you mean, that i should start a new session for each user? Does zf keep last url in session automatically? sorry, i'm new to zf
flufferok
I think that ZF does not keep url in session automatically. But you could create some session variable and keep it there.
Marcin
A: 

One option would be to make the vote via AJAX, while sending in the current URI as a parameter and receive the URI to be redirected to in the AJAX-response.

chelmertz