Back to the search result |
[eluser]Omaplie[/eluser]
Hi everyone ! My question is simple : how can I design a « back to the search result » button ? I created a search result who display a list of link. How to do when a user go to one link and want to go back to his search result ? I saw that I can use JS : Code: '[removed]window.history.go(-1);' Someone can help me ? Thank you a lot !
[eluser]nagata[/eluser]
put this into page load part (somewhere in controller code) Code: $this->load->library('session'); and put this code into controller function that displays the one result item Code: <?php tell me if anything is wrong, I havent tested this code yet, but in theory, if your search info is passed as url (ex. http:/localhost/index.php/search/trololo) this code will in first part: using url helper get the current url, and using session library will put that url into flash data as 'previus_adress' and in the other part it will retrive that flash data from session using the session library and echo it onto page in form of normal link for the question why i use flashdata instead of normal session data is because flash data will exist only for one load, so no need to clear anything if user decides not to return back to result list
[eluser]Samus[/eluser]
Or just Code: $this->agent->referrer() http://ellislab.com/codeigniter/user-gui...agent.html
[eluser]Omaplie[/eluser]
I tried what you said nagata but unfortunately it doesn't work, it redirects me to the page before the search. When I search something I have a « Page1 », I have a result « Page2 » and I choose a result « Page3 ». The link from the « Page3 » redirect me to the « Page1 » and not to the « Page2 ». My URL from the « Page2 » is like that : « http://localhost/web3/CodeIgniter/scout2...arch_totem » That's why it doesn't work. But I never pass values get from a form to a url, I am sorry. I am looking on the internet but can you give me some informations about this ? Thank you for your help. Samus, I don't really understand the documentation about Code: $this->agent->referrer() Thank you very much you both.
[eluser]Omaplie[/eluser]
It fine, I save the value that the user enter in a data and when I go back to the search result I make the request with the value in the userdata. It works fine, thank you very much |
Welcome Guest, Not a member yet? Register Sign In |