Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

tj2001

macrumors regular
Original poster
Dec 7, 2003
185
0
Florida - USA
Hey all,

Been working on a site and it's about 98% done now :) I'm having an issue where the site is framed with a about three <frameset>'s. Because of how I wanted it to scroll and where the main content was.

Now my issue is this my navigation is in a frame of itself. I wanted to use like this:

Code:
if ($page == "Home") {
	echo "<img src=\"../images/nav/ocalagrooming_03-over.png\" alt=\"Home\" width=\"148\" height=\"39\" align="top\" border=\"0\">";
} else {
	echo "<a href=\"../index.php\" target=\"_top\" onmouseover=\"imgOn('img1'); window.status='Groomed to Perfection'; return true\" onmouseout=\"imgOff('img1'); window.status=''; return true\"><img
src=\"../images/nav/ocalagrooming_03.png\" alt=\"Home\" width=\"148\" height=\"39\" align=\"top\" border=\"0\" name=\"img1\"><br /></a>";
}

Now on the page Home at the top it defines $page, problem is PHP doesn't see this because it's in separate frames! Any help on how to correct this or a right way?
TIA
 
Don't know why you want to use frames when you're making the pages with php. You can just make a generic index file (or one for each theme) where you include the contents from php/html/inc files... Frames is overkill and shouldn't be used... ever...
 
Mitthrawnuruodo said:
Don't know why you want to use frames when you're making the pages with php. You can just make a generic index file (or one for each theme) where you include the contents from php/html/inc files... Frames is overkill and shouldn't be used... ever...

I'm using frames because I like the cleanliness of keeping the nav and whatever else still while just scrolling through content. Also the client requested... customer is always right :)

Yes I could've used simple includes for each page, but it wouldn't accomplish the framing.

Now can you help me please?
 
tj2001 said:
I'm using frames because I like the cleanliness of keeping the nav and whatever else still while just scrolling through content. Also the client requested... customer is always right :)

This can be done using CSS to fix the position of specific elements, for example, as used on the CSS spec page - http://www.w3.org/Style/CSS/

I don't know the exact CSS for this unfortunately but I'm sure someone can help on that.

Refering to variables within the parent page and child frames will be a nightmare. You'd have to either pass them via the URLs, eg.

<frame src="<? echo $page; ?>?page=<? echo $page; ?>" name="main" scrolling="auto" frameborder="0" noresize />

...or via sessions. Going to get pretty complex in either case.
 
sorry to hijack the thread, but..

does this mean you can just get php to call in new information and display that instead of having to reload another page?
 
frames aren't necessary. you can set the css of a block element to { overflow: auto; } and it will have a scroll bar if the area is too small for the content. if you're really keen on loading separate data into the same page (as opposed to just using php to generate a page from separate sources), try using the Sack (a single-file Ajax toolkit). All it takes is linking to one javascript file and writing one simple function of your own, and you can load an external xml/html file into a <div> on your page with the {overflow: auto;} property. it would probably take about 5 minutes to set up and wouldn't require frames, plus, you can add the latest web development buzzword to your list of services ;)
 
If you must use frames, then you have to treat each framed page as a separate, stand-alone document and load all function libraries or global vars on the pages loaded in EACH frame.

Or, you will have to pass shared variables from the frameset page to the framed page via the URL. Then just load that variable from the $_GET[] array.

This is why web developers don't use frames anymore on websites. Not only are they a pain to get working, but they are also not very search-engine friendly at all, and make your site logs a total mess. You would be better off using iFrames and/or CSS.
 
pulsewidth947 said:
does this mean you can just get php to call in new information and display that instead of having to reload another page?

...frames are (well, not as much now, but they used to be) used for that purpose. They're really just HTML, but, of course, you can use PHP to output the right html...
 
jestershinra said:
...frames are (well, not as much now, but they used to be) used for that purpose.

What I actually meant in my head was having the page loaded, and the php information on a new css layer above it. Now instead of reloading another page.php, i wondered if you could just call in the information to that layer. This would speed things up if you have lots of background graphics. But anyway, its off topic.. maybe i should make a new thread :)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.