Client selectable iframe content

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Trunkie
Forum Newbie
Posts: 1
Joined: Fri Nov 26, 2004 5:14 am

Client selectable iframe content

Post 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
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post 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.
Post Reply