XyberForce
Sep 21 2007, 06:45 AM
I was reading up on something the other day, it was called page auto-change or something like that. But I don't know exactly what it was called. It said that once you update one page on your website, all the others will, too. Now I wish I had that code. Any suggestions? Because in my old site, I had to change the navigation for every single page every time I updated it, and I don't want to have to do that this time.
Server side inclusion sounds to me what you're looking for.
In php:
CODE
<html>
<head>
<title>Page title</title>
</head>
<body>
<?php echo file_get_contents('navigation.html'); ?>
<div id="content">
Content
</div>
</body>
</html>
If you have php in the navigation, use an include instead:
CODE
<?php include 'navigation.html'; ?>
Couple of links:
http://www.php.net/file-get-contentshttp://www.php.net/includeFor a finer grain of control you can template your whole site, but if it's just a navigation, stick with the former.
XyberForce
Sep 21 2007, 07:04 AM
Will the table automatically wrap it if I put the code in there? Btw thanks for helping. =]
Yup, it'll appear inline with the statement, so providing your HTML is correct and you've not chopped out any tags etc, display won't be altered.
alecrust
Sep 21 2007, 07:34 AM
Damn you got there before I did Bread

Yeah he is spot on. Make sure your files also have the .php extension.
MrCracker
Sep 21 2007, 02:32 PM
Yah this is very helpful when designing websites.
XyberForce
Sep 21 2007, 06:00 PM
Tried it, it works fine.
Dan
Sep 22 2007, 02:27 AM
Yo Bread
What are the benefits of using file_get_contents over a simple include? Especially if get_contents doesn't allow PHP?
QUOTE(Dan @ Sep 22 2007, 02:27 AM)

Yo Bread
What are the benefits of using file_get_contents over a simple include? Especially if get_contents doesn't allow PHP?
From a conventional view, it is better to serve static content via a method created to serve static content, there's no requirement to parse the content, so using an include is somewhat frivolous.
I did some benchmarks, results show about a 10% increase in using include over file_get_contents:
http://bread.zymic.com/benchmarks/include_...e_get_contents/While it's barely significant unless you're doing huge loops; it is technically faster

.
XyberForce
Sep 29 2007, 09:31 PM
Also, why do people hate iFrames so much? They are extremely convenient (my opinion) but, I have to go with the flow, that's why I try to avoid them.
Alex
Sep 29 2007, 09:38 PM
Mostly because of SEO issues, only very advanced spiders are aware of frames, generally they'll index each page separately, which is very unlike the page the user sees. Whereas SSI builds the page as one entity, which all spiders index as one.
So, iframes mean loss of meta data, and the search engine indexing individual parts of the site separately (meaning when they follow the link they are presented with one part of the website - provided the page works when not in a frame).
Cmain
Sep 29 2007, 10:08 PM
QUOTE(XyberForce @ Sep 29 2007, 05:31 PM)

Also, why do people hate iFrames so much? They are extremely convenient (my opinion) but, I have to go with the flow, that's why I try to avoid them.
A CSS approach with an include is much better anyhow.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.