Welcome Guest, Not a member yet? Register   Sign In
URL
#1

[eluser]chinedubond[/eluser]
please i am trying get the present url am in.

also how can i get the history from the controller.
i know i can get from javascript. history(-1)
but how can i do that with CI from my controller.thank you.
#2

[eluser]Clooner[/eluser]
To get the current url try $_SERVER['REQUEST URI'] and to get the page you came from try $_SERVER['HTTP_REFERER']. Hope this helps
#3

[eluser]chinedubond[/eluser]
thanks but does not work it does however return the last url
but i was looking for a CI function or something.
That give the previous page.
Thanks
#4

[eluser]Dan Bowling[/eluser]
Not sure exactly what you are looking for (or that you are still looking for it, since this is an old thread) but I've got some code that works with CI 1.6 to do something similar.

Code:
$this->session->set_flashdata('referer', $this->uri->uri_string());

This grabs the current URI for everything past index.php and sets it to the temporary flash data.

Code:
echo $this->session->flashdata('referer');

This simply retrieves and echos the last page URI.

I put the first chunk of code in my global header view, which gets included in all pages (you could probably find better places to put it, but that's what worked for me)

Then, when I need to send the referer, I just reference that.
#5

[eluser]Colin Williams[/eluser]
Search the Wiki for the Whence library. It appears to be a nice server-side history mechanism.

Edit: Go here: http://ellislab.com/forums/viewthread/86394/




Theme © iAndrew 2016 - Forum software by © MyBB