Hello,
I'd like to make something special with php...
I'd like to define in an array a list of urls that will be visited by my script.
When a user go to myscript.php he will see the first web page defined in the
array. 5 seconds later he will see the second page...
5 seconds ater... the third page...
I don't know how to do this with PHP.
(the redirect can only be done with Javascript) but the problem is to know
if I must use "include"
I don't think using the include function is a good idea since I can't include external
website (on most server PHP configuration).
I also wonder if I should use frame...
my PHP script will be in a frame and the visited website in a other one...
The frame containing the php script could be resize to height=0 and width=0
This is probably just a trick but I don't know how to do something better.
Do you have any idea ?
Kind regards
Redirecting automaticaly to a website
Moderator: General Moderators
Re: Redirecting automaticaly to a website
Have a look at a meta refresh tag. 
http://webdesign.about.com/od/metatagli ... 80300a.htm
All browsers don't support it (or it can be user disabled), but I'd say a lot more support that than users that have javascript disabled.
http://webdesign.about.com/od/metatagli ... 80300a.htm
All browsers don't support it (or it can be user disabled), but I'd say a lot more support that than users that have javascript disabled.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Re: Redirecting automaticaly to a website
The problem of this is that if I put this tag in my script I will redirect to another website... but it wouldn't redirect 5 seconds later to the second site... (because I can't put a redirect tag on the first website)
Re: Redirecting automaticaly to a website
can you tell us what the purpose of your site is?
Re: Redirecting automaticaly to a website
If you can't modify the contents of the other sites, then you have little choice but to use frames--One frame would use JavaScript to refresh the adjacent one. Know that a website can be coded to break out of frames.
Re: Redirecting automaticaly to a website
I want to have a browser in kiosk mode (full screen) that is connected on a small computer (such as http://www.linutop.com ) and which is connected on a big screen.
When you have a look at the big screen you will see the content of 4 webpages (news, timetable...).
and the content is changing every 5 or 10 seconds.
So you really think that there is no way to avoid frames ?
How many child frame I need ? (I only want to see one web page at a time)
Here is a sample (index.php)
I wonder if I really need the frame script.php because all the mechanism of changing the page to see
(page_xx.php) has to be done in the index.php
Maybe it will looks someting like...
I know that it's quite strange to have only 1 frame in a frameset...
What is your opinion about it ?
When you have a look at the big screen you will see the content of 4 webpages (news, timetable...).
and the content is changing every 5 or 10 seconds.
So you really think that there is no way to avoid frames ?
How many child frame I need ? (I only want to see one web page at a time)
Here is a sample (index.php)
Code: Select all
<html>
<head>
<title>Title</title>
</head>
<frameset cols="10%,90%" border="0">
<frame src="script.php">
<frame src="page_xx.php">
</frameset>
<noframes>
<body>
<p>frames are not supported</p>
</body>
</noframes>
</html>
(page_xx.php) has to be done in the index.php
Maybe it will looks someting like...
Code: Select all
<html>
<head>
<title>Title</title>
</head>
<frameset cols="100%" border="0">
<frame src="page_xx.php">
</frameset>
<noframes>
<body>
<p>frames are not supported</p>
</body>
</noframes>
</html>
I know that it's quite strange to have only 1 frame in a frameset...
What is your opinion about it ?
Re: Redirecting automaticaly to a website
I found a much better way to do what I was looking for : "iframe"
http://en.wikipedia.org/wiki/IFrame
http://en.wikipedia.org/wiki/IFrame
Code: Select all
<?php
/*
Usage : http://127.0.0.1/php/affich/index.php?page=0
*/
class pages {
private $i;
private $liste;
public function __construct($liste) {
$this->i=0;
$this->liste=$liste;
}
public function __destruct() {
//echo "DESTRUCT";
}
/*
private function set_pages($liste) {
$this->liste=$liste;
}
*/
private function set_i($i) {
if ($i<=count($this->liste)-1) {
$this->i=$i;
} else {
$this->i=0;
}
}
private function get_next_i() {
if ($this->i==count($this->liste)-1) {
return 0;
} else {
return ($this->i+1);
}
}
private function get_previous_i() {
if ($this->i==0) {
return count($this->liste)-1;
} else {
return ($this->i-1);
}
}
/*
public function goto_next_page() {
$this->i=$this->get_next_i();
$this->show();
}
public function goto_previous_page() {
$this->i=$this->get_previous_i();
$this->show();
}
*/
private function show() {
$url_next= "{$_SERVER['PHP_SELF']}?page=" . $this->get_next_i();
$url_previous= "{$_SERVER['PHP_SELF']}?page=" . $this->get_previous_i();
//echo "Show page n $this->i : {$this->liste[$this->i]}<br>\n";
$url_include = $this->liste[$this->i];
echo "<html>
<head>
<title>Afficheur</title>
</head>
<body>
<script type=\"text/javascript\"><!--
setTimeout('Redirect()',4000);
function Redirect()
{
location.href = '$url_next';
}
// --></script>
<!-- Show page n $this->i : {$this->liste[$this->i]}<br> -->
<iframe src=\"$url_include\" height=\"100%\" width=\"100%\" frameborder=\"0\">
Alternative text for browsers that do not understand IFrames.
</iframe>
</body>
<!-- <a href='$url_next'>Page suivante<br></a> -->
<!-- <a href='$url_previous'>Page précédente<br></a> -->
</html>";
}
public function goto_page($i) {
$this->set_i($i);
$this->show();
}
}
$list = new pages(
array(
"page0.php",
"page1.php",
"page2.php?param1=1",
"page3.php")
);
$page=$_GET['page'];
if (!is_numeric($page)) {
$page=0;
}
$list->goto_page($page);
?>