PDA

View Full Version : change iframe at different day of the week



c121
01-16-2014, 02:44 PM
Hello,

I use now this iframe schript:

<iframe src="www.mysite.com/link.php" width="100%" height="280"> </iframe>

<script language="javascript" type="text/javascript">

But I need a Iframe script that use a differend url based on the day of the week. Like something:

Iframe www.mysite.com/monday.php
Iframe www.mysite.com/tuesday.php
etc.

Is this possible?

Beverleyh
01-16-2014, 03:13 PM
With php you could echo the day of the week in the iframe src to open a page named each weekday;

src="path/to/page/<?php echo date("l");?>.php"should output something like;

src="path/to/page/Monday.php"
See here for date format in php http://www.php.net/manual/en/function.date.php

Not sure of the equivelant with JavaScript though.

Beverleyh
01-16-2014, 03:20 PM
On checking the DD library there's a daily iframe script there: http://www.dynamicdrive.com/dynamicindex17/dowiframe.htm

Might be what you need.

c121
01-16-2014, 09:39 PM
Thanks for the fast responso!
This code works great:

src="path/to/page/<?php echo date("l");?>.php"