Welcome Guest, Not a member yet? Register   Sign In
Back to the search result
#3

[eluser]nagata[/eluser]
put this into page load part (somewhere in controller code)
Code:
$this->load->library('session');
$this->load->helper('url');
$my_url=current_url();
$this->session->set_flashdata('previus_adress', $my_url);

and put this code into controller function that displays the one result item
Code:
<?php
$this->load->library('session');

$my_url=$this->session->flashdata('previus_adress');
echo '<a href="'..'">Go Back to results</a>'
?&gt;

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


Messages In This Thread
Back to the search result - by El Forum - 06-08-2012, 09:39 AM
Back to the search result - by El Forum - 06-09-2012, 03:19 AM
Back to the search result - by El Forum - 06-09-2012, 03:50 AM
Back to the search result - by El Forum - 06-09-2012, 03:56 AM
Back to the search result - by El Forum - 06-09-2012, 05:31 AM
Back to the search result - by El Forum - 06-09-2012, 01:37 PM
Back to the search result - by El Forum - 06-09-2012, 04:47 PM



Theme © iAndrew 2016 - Forum software by © MyBB