Rotating URL website Code

Hi all,

I've searched this to death but didn't find much.

Basically we have a plasma screen in our office which has to look at
about 4 different websites (bbc news etc) on a regular basis.

I wrote a nice little array which half works but doesn't load the
pages properly. Code is:

<?
$pages = array(
'http://nerws.google.co.uk','http://www.sky.com/news','http: //
www.bbc.co.uk/news');
shuffle($pages);
include($pages[0]);
?>


Basically after 60 seconds I'd like to randomly show one of the news
websites.

If anyone can help point out where I'm going wrong or a better way to
do this it would be excellent. I'd like to learn how to fix this, as
well as find a solution so anyone willing to offer a little tutorial
would be most appreciated.

Thanks

Si.
Sibine [ Mi, 16 Januar 2008 18:41 ] [ ID #1909746 ]

Re: Rotating URL website Code

I've done some further work on this and realise that its loading the
URLs in the same page and thus thats why CSS and some images don't
work as it looks for them on my server (which they obviously aren;t).

I guess the best way is to have this page running and basically it
auto changes another IE window by setting it to load it in a different
target?

Obviously I need to add the header reload/refresh so the script
continues to run, but I'm still trying to work that out too!
Sibine [ Mi, 16 Januar 2008 18:48 ] [ ID #1909747 ]

Re: Rotating URL website Code

Sibine wrote:

> If anyone can help point out where I'm going wrong or a better way to do
> this it would be excellent.

Using Javascript and frames. Two frames. Very thin one at the top. Very
big one underneath. In the top frame, call a Javascript function every 60
seconds, that loads a URL into the bottom frame. Easy.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 17 days, 5:21.]

Gnocchi all'Amatriciana al Forno
http://tobyinkster.co.uk/blog/2008/01/15/gnocchi-allamatrici ana/
Toby A Inkster [ Mi, 16 Januar 2008 19:09 ] [ ID #1909751 ]

Re: Rotating URL website Code

If any of the sites have some sort of anti-frame javascript, you may
have problems - but worth trying. Another option may be to have four
(or however many) browser windows open to the correct pages, and some
sort of code on the actual computer to shuffle through them somehow...

---
www.NEXCESS.NET - Shared/Reseller Hosting
www.EliteRax.com - Dedicated Servers, Server Clusters
www.MaxVPS.com - Virtual Private Servers
- Great prices, Great service - check us out!


On Jan 16, 1:09 pm, Toby A Inkster <usenet200... [at] tobyinkster.co.uk>
wrote:
> Sibine wrote:
> > If anyone can help point out where I'm going wrong or a better way to do
> > this it would be excellent.
>
> Using Javascript and frames. Two frames. Very thin one at the top. Very
> big one underneath. In the top frame, call a Javascript function every 60
> seconds, that loads a URL into the bottom frame. Easy.
>
> --
> Toby A Inkster BSc (Hons) ARCS
> [Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
> [OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 17 days, 5:21.]
>
> Gnocchi all'Amatriciana al Forno
> http://tobyinkster.co.uk/blog/2008/01/15/gnocchi-allamatrici ana/
adwatson [ Mi, 16 Januar 2008 20:52 ] [ ID #1909762 ]

Re: Rotating URL website Code

adwatson wrote:
> If any of the sites have some sort of anti-frame javascript, you may
> have problems - but worth trying. Another option may be to have four
> (or however many) browser windows open to the correct pages, and some
> sort of code on the actual computer to shuffle through them somehow...

There might be some browser plugins/addons as well.

-thibī
thyb0 [ Mi, 16 Januar 2008 21:46 ] [ ID #1909764 ]

Re: Rotating URL website Code

Thanks very much for all your help. I'll try the frames out later and
see how it goes :)
Sibine [ Do, 17 Januar 2008 11:26 ] [ ID #1910719 ]

Re: Rotating URL website Code

On 17 =D7=99=D7=A0=D7=95=D7=90=D7=A8, 12:26, Sibine <simon.jes... [at] gmail.com>=
wrote:
> Thanks very much for all your help. I'll try the frames out later and
> see how it goes :)



try this one that I amended specially for you to work with Iframe...
You can drop the top menue and autostart the script.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
<html>
<html>
<head>
<script language=3D"JavaScript">
<!-- Begin
var repeatshow =3D 1; // 1 =3D yes, 0 =3D no
var timedelay =3D 10000; // time in milliseconds, 5000 =3D 5 secs

var page =3D new Array(
"http://cafe.themarker.com/view.php?u=3D70158",
"http://www.ynet.co.il/",
"http://www.google.com/advanced_search?hl=3Den&num=3D100",
"http://www.morfix.co.il/",
"http://www.tamir.co.il/",
"http://www.i-property.co.il/",
"http://www.ymap.co.il/",
"http://cafe.themarker.com/"


); // note no comma after last page!

// your "the end" page. Necessary if repeatshow =3D 0;
var endpage =3D "http://www.sharatim.co.il";

var slidenum =3D 0;
var slidecount =3D page.length;
var timerID =3D 0;
var win2;
function showSlideShow() {
slidenum++;
if (slidenum < slidecount+1) {
parent.main.location.href =3D page[slidenum-1];
}
if (slidenum =3D=3D slidecount+1) { // if finished
if (repeatshow) {
slidenum =3D 0;
timerID =3D setTimeout('showSlideShow()', timedelay)
}
else parent.main.location.href =3D endpage;
}
else timerID =3D setTimeout('showSlideShow()', timedelay);
}
// End -->
</script>


</HEAD>

<BODY onload=3D"timerID=3DsetTimeout('showSlideShow()',timedelay)">
<center>

<a href=3D"javascript:showSlideShow();"
onClick=3D"clearTimeout(timerID)">Cycle Pages</a> ..........
<a href=3D"#" onClick=3D"clearTimeout(timerID)">STOP</
a> ..........
<a href=3D"http://www.tamir.co.il" target=3D"main"
onClick=3D"clearTimeout(timerID)"><B>Stop [at] My PAGE </B></A>

<IFRAME SRC=3D"main.html" name=3D"main" WIDTH=3D100% HEIGHT=3D95%>

</center>


</div></BODY>

</HTML>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D

Good luck
tamirdoron [ Mi, 23 Januar 2008 10:27 ] [ ID #1914750 ]
PHP » comp.lang.php » Rotating URL website Code

Vorheriges Thema: Sessions
Nächstes Thema: How get skipped row count in PDO-MYSQL when use 'LOAD DATA INFILE'