Welcome Guest, Not a member yet? Register   Sign In
Redirect page after some delay
#1

[eluser]Suhas nazir[/eluser]
Is there any way to redirect a page in code igniter after a particular period of time.like meta..
#2

[eluser]troy_mccormick[/eluser]
A read through the entire user guide may be in order for you, but here is the relevant section for you:

Quote:redirect()

Does a "header redirect" to the local URI specified. Just like other functions in this helper, this one is designed to redirect to a local URL within your site. You will not specify the full site URL, but rather simply the URI segments to the controller you want to direct to. The function will build the URL based on your config file values.

The optional second parameter allows you to choose between the "location" method (default) or the "refresh" method. Location is faster, but on Windows servers it can sometimes be a problem. The optional third parameter allows you to send a specific HTTP Response Code - this could be used for example to create 301 redirects for search engine purposes. The default Response Code is 302. The third parameter is only available with 'location' redirects, and not 'refresh'. Examples:

Code:
if ($logged_in == FALSE)
{
     redirect('/login/form/', 'refresh');
}
#3

[eluser]Suhas nazir[/eluser]
Sry i am actually looking to redirect a page after a particular period of time for example after a 5 second..is there any way.
#4

[eluser]troy_mccormick[/eluser]
Why not put the meta tag within your view then? I'm sure you could extend the URL Helper to let the refresh time to be configurable too. Just a thought.
#5

[eluser]Suhas nazir[/eluser]
meta tag is some what html oriented infact i am looking for a codeigniter code any way thanks fr ur replay...
#6

[eluser]nelson.wells[/eluser]
Look up the php function sleep(). Maybe in your controller you could sleep the script for 5 seconds (or however long) before you send the headers. I haven't tried it, but it is worth a shot.
#7

[eluser]dark_lord[/eluser]
What about trying to embed this one on your meta tags?

<meta http-equiv="refresh" content="600">

600 - is the amount of time to wait before it redirects.
#8

[eluser]Unknown[/eluser]
Late reply but I believe that this will do what you want:
Code:
$this->output->set_header('refresh:5;url=wherever.php');

further documentation can be found here:
http://ellislab.com/codeigniter/user-gui...utput.html
#9

[eluser]Cesar Kohl[/eluser]
I inserted this:

Code:
$this->output->set_header('refresh:3; url='.$this->base);

Thank you for this tip, Alt_F4!
#10

[eluser]Unknown[/eluser]
use this code in your controller :

header("RefreshConfusedeconds;url="your path");

eg:
header("Refresh:10;url=".base_url()."index.php/welcome");




Theme © iAndrew 2016 - Forum software by © MyBB