PDA

View Full Version : Frames vs Divs


cweaver
11-10-2005, 10:49 PM
I must apologize first if this is not the correct forum for this question. I'm hoping there is an alternative to frames within the PHP / CSS world and I'm guessing it might be divs.

Using frames I can do this
<BASE TARGET="main">
and refill a specific area within a page each time the visitor clicks a link without reloading the entire page.

How would you get around reloading an entire page when all you want to change is the content area in the center div? -- or can this be done with PHP? I can't see it myself, but I'm no PHP expert.

I know how I would do this if I were to download all of the content options then choose to reveal one portion then another. I'm working on a large site and would like to send out the banner/menu and the background/side panels only once.

How would you go about this?

poncho
11-10-2005, 11:35 PM
Hey cweaver,

You would probably be better posting in an html forum, but since you're here...

If it is not a big deal and you don't want anything too complex, I would use an iframe:

<iframe frameborder="0" src="ads.php" id="adframe">Oh dear, it appears your browser does not supprt frames.</iframe>

Then you could use css to style the element like so:


#adframe {
margin: 0 auto;
width: 400px;
height: 90px;
}


I hope that at least gives you an idea.

Cheers;
Poncho

cweaver
11-11-2005, 12:16 AM
Thanks poncho. And thanks especially much for staying up so late; although I suppose you're not burning the midnight oil just to answer my questions.

I'll give the iframe thing a try.

Pyth007
11-11-2005, 01:21 AM
If it's just small content that you want to change, then using divs and hiding / showing them is probably the way to go... But it sounds like you want a page used for your entire site, and each content-page may be very different. In that case, frames may be better. For one thing, frames can open new html and/or php files inside them. This becomes very useful if you are also working with server-side info (like a DB) in order to make your site dynamic. You'll probably end up using a combination of both approaches; use frames for major page changes (eg moving from a 'shopping cart' to a 'payment info' form) and then use div's for minor stuff (eg view / hide 'tax calculation' depending upon where the item is being bought from (state taxes only being applied if both purchaser and seller are in the same state))

Oh and just realize that not all browsers handle frames well (IE, FF, and other major ones shouldn't have any problems; rather browsers like those designed for the blind, etc. are the ones likely to throw a fit)... if compatability is a major issue, you may have to reload the entire page anyhow...