I have a simple home page that I want to use to learn how to use SSI to set up my nav bar on the top and right with, so it can be quickly and easily updated in the future. (Would like to eventually figure out how to use this to display my banners and videos as well.)
I found some information on google, but its from pretty far back. It did help me get the jist of the include code etc though.
But there were no examples I could find on how to set up a nav bar, and have it appear on all your html pages.
I also have the nav bar currently set up with certain CSS styles, can I maintain that same color and style setup etc while using the SSI to somehow show the content of the nav bar within or using those style settings?
I hope to learn how to do this well, and I am eager to learn for any who want to help me.
There are a number of ways to do it but a PHP include is probably your best bet as most servers have PHP and only Microsoft IIS can run ASP. If your preference is to use ASP instead, contact your hosting provider and see what servers they use (can probably find it in service documentation as well). Anyway.
With PHP, it's quite simple. Take the nav bar code and isolate it (no normal HTML body tags or DOCTYPE--just the nav markup) in its own PHP file:
Remove it from its original markup document and put this (or equivalent) in its place:
Code:
<?php include("navbar.php"); ?>
where navbar.php is the name of the file with the nav code. Resave your original markup document, now with the PHP include, with a .php file extension. Upload to server running PHP and voilà, SSI.
As far as your stylesheet is concerned, the browser parses the CSS code once the HTML file ("assembled" at the server by PHP) is delivered, so the browser "sees" exactly the same thing as if you didn't use the SSI at all--your stylesheets can remain the same.
If I may: You need to rename it with a .php file extension--this tells the server to process the file with PHP and not just relay it as static (X)HTML. You should also know that unless you have your local computer set up as a server running PHP, you won't be able to test the files until you upload them to your remote server. It makes testing a little more cumbersome, but the benefits of server-side processing far outweigh the inconvenience.
I meant to say I am doing it all on my pc, will create files with test names, upload them to godaddy, then test them on their server, thanks for the tips.
Uploaded it to my godaddy server where my web page is hosted
Also created a file rightnav.php and put this in there for the nav bar
Quote:
<ul>
<li>
<a href="coming_soon.html"><img src="images/nav_bullet.gif" border="0" /> Postcards from the Edge <img src="images/spacer.gif" width="14" height="10" border="0" />of the Green Economy
</a>
</li>
</ul>
And when i got to the url for the html page, the spot where the php nav bar should be showing up is only showing my css style stuff like background color, the php file is in a subfolder under the main root folder called "includes" , which i included in the path info, please help me figure out what I am doing wrong