Simple CSS (I think) problem???

supergper

Gawd
Joined
Apr 25, 2005
Messages
766
Alright, I've been working on my site and trying to use CSS as much as possible (first time writing my own stylesheet from nothing). I want to add a menu for navigational reasons also I have the same info that loads at the top of each page. Short of putting the exact code at the top of each page how can you put that same info using CSS (or any other way as well)? I don't want to have to reload the menu and other same items each time the page changes (kind of like on here, when you click to go to a different thread or forum the menu doesn't reload)???

Help!?!?!
 
Alright, I've been working on my site and trying to use CSS as much as possible (first time writing my own stylesheet from nothing). I want to add a menu for navigational reasons also I have the same info that loads at the top of each page. Short of putting the exact code at the top of each page how can you put that same info using CSS (or any other way as well)? I don't want to have to reload the menu and other same items each time the page changes (kind of like on here, when you click to go to a different thread or forum the menu doesn't reload)???

Help!?!?!

You can call it with PHP, and have your header information within a PHP file.

I'll give you a simple example. Let's say you change tracking services often.
You are using Google's tracking right now, but want to switch to StatCounter.

You have ONLY the Google tracking code within a file (let's say it is named tracking.php), and no formatting or other data. If you want to switch to StatCounter and stop using Google's service, just paste your new SC code into tracking.php.

Now the beauty of it, is that within each page, you call up that tracking.php file.
When that file gets called up, it's contents are processed (if it has even more php info for example), and then added to the final page that vistors see.

In this case, it would load the contents of tracking.php, so in the end, you just gotta update that single file.

I personally don't have a huge website, so I just manually update the darn thing whenever I make a global change (not often), but if you have a larger website it comes in handy.

I'm really more of a "look it up" sort of guy, and really cannot write php from scratch, so someone correct me if I am wrong, but here is what you would need to use:

Code:
<?php include (path/tracking.php'); ?>

You could actually have tracking.php be an html file if you wished, but what NEEDS to be php is the page actually doing the work- which is the page calling it.
 
You can call it with PHP, and have your header information within a PHP file.

I'll give you a simple example. Let's say you change tracking services often.
You are using Google's tracking right now, but want to switch to StatCounter.

You have ONLY the Google tracking code within a file (let's say it is named tracking.php), and no formatting or other data. If you want to switch to StatCounter and stop using Google's service, just paste your new SC code into tracking.php.

Now the beauty of it, is that within each page, you call up that tracking.php file.
When that file gets called up, it's contents are processed (if it has even more php info for example), and then added to the final page that vistors see.

In this case, it would load the contents of tracking.php, so in the end, you just gotta update that single file.

I personally don't have a huge website, so I just manually update the darn thing whenever I make a global change (not often), but if you have a larger website it comes in handy.

I'm really more of a "look it up" sort of guy, and really cannot write php from scratch, so someone correct me if I am wrong, but here is what you would need to use:

Code:
<?php include (path/tracking.php'); ?>

You could actually have tracking.php be an html file if you wished, but what NEEDS to be php is the page actually doing the work- which is the page calling it.

yeah, I know about include...but that still loads that same code on each page load...so really the only thing that does for me is make it easier to manager that one part, I'm actually trying to optimize so redundant stuff isn;t reloaded on each page??? Thanks though...
 
yeah, I know about include...but that still loads that same code on each page load...so really the only thing that does for me is make it easier to manager that one part, I'm actually trying to optimize so redundant stuff isn;t reloaded on each page??? Thanks though...

I guess I'm unsure of what you are asking I guess...

You obviously don't have to put the php statement in each page.

Or if you want different files for different pages, just use something like ipodheader.php and macheader.php for the diff. sections of your website (judging by your URL, your website is down so I have no idea what it's about).
 
I guess I'm unsure of what you are asking I guess...

You obviously don't have to put the php statement in each page.

Or if you want different files for different pages, just use something like ipodheader.php and macheader.php for the diff. sections of your website (judging by your URL, your website is down so I have no idea what it's about).

actually it's a different site www.watchourhousegetbuilt.com think of it as frames and I only want to re-load the content frame (because it's different on each page), not the menu frame (because it's the exact same on each page)...does that make sense?
 
Check out my site - it's in bad shape right now - I just set it up before applying for a job last year:

http://www.benefiel.net/

Anyway, click the navigation links: See how the menu doesn't reload?

The code is really simple!

Code:
<?php
		if(isset($_REQUEST['page'])) {
		
			switch ($_REQUEST['page']) {
			
				/* Programming */
			
				case python:
					include("inc/python.inc");
				break;
			
				case php:
					include("inc/php.inc");
				break;
				
				case aspnet:
					include("inc/aspnet.inc");
				break;
			
				case javascript:
					include("inc/javascript.inc");
				break;
				
				case shellscript:
					include("inc/shellscript.inc");
				break;
				
				/* Systems Administration   */
				
				case inventory:
					include("inc/inventory.inc");
				break;
				
				case infrastructure:
					include("inc/infrastructure.inc");
				break;
				
				case computerlab:
					include("inc/computerlab.inc");
				break;
				
				case navce:
					include("inc/navce.inc");
				break;
				
				case firewall:
					include("inc/firewall.inc");
				break;
			
				case webdesign:
					include("inc/webdesign.inc");
				break;
				
				
			}
		
		} else {


(sorry, I meant to post this a long time ago - I got distracted and forgot to click submit)
 
actually it's a different site www.watchourhousegetbuilt.com think of it as frames and I only want to re-load the content frame (because it's different on each page), not the menu frame (because it's the exact same on each page)...does that make sense?

Yes, is there a reason why?

iframes may be your easiest option, someone else may have an idea, but as far as I'm aware (Like I said- I can't sit down and script with my eyes closed, I don't know php/html/css like a god or anything) it's your only option.

As you may be aware, it's not a good option, either.

I see as to why you want to do it this way, is to keep the animation rolling.
I think you won't get what you are looking for without converting the whole thing to flash (again- not a good option).

Someone may have an idea, but because that graphic is more of a slideshow, I really don't think it would bother people too much.
 
(sorry, I meant to post this a long time ago - I got distracted and forgot to click submit)

hmm, pretty cool I must say. I didn't know you could do this with php, actually :)
Similar to swapimage.

"I got distracted and forgot to click submit"- I am glad I'm not the only one that starts replying to one thread and then forgets to come back to it ;)
 
Back
Top