Page 1 of 1

Client selectable iframe content

Posted: Fri Nov 26, 2004 5:35 am
by Trunkie
First off I'm new here so apologies if this is posted in the wrong place. Secondly I have *NO* experience of php so go easy on me!

I'm building a site that has a news feature iframe appearing on several pages
On some pages this iframe has random content in it - selected from a max of 4 items.
On other pages it needs to contain fixed content.

My client would like the facility to alter whether the pages contain random or fixed content himself. He cannot code! What is the easiest way of achieving this?

Many thanks

Posted: Fri Nov 26, 2004 5:46 am
by phpScott
the easest way I can think of doing this would be to when you set the source for the IFRAME is to pass along another variable that tells the page what to load.

Code: Select all

document.getElementById('frameName').src = 'loadedIframePage.html?load=1';
would load the first page of static content.

Code: Select all

document.getElementById('frameName').src = 'loadedIframePage.html?load=0';
would load a random page

on the loadedIframePage.html your page could test in javascript what was passed and if it was 0 do a random selection page. if it isn't 0 then load the static page.

the last bit could also be done in php which would be alot nicer and easily done.