| Posted: 29 February 2008 at 3:23pm | IP Logged
|
|
|
Well there are actually at least six ways:
SSI - and using the extension shtml or shtm (server side) ASP - using the extension asp (server side) PHP - using the extension php, phtml, phtm (server side) JavaScript - using the extension html or htm (client side) Ajax - more information Ajax Includes Script Frames
They depend on your server and the way it is set up. Including the file is is basically like SSI Code <!--#include file="includes/nav.html" --> ASPCode <!--#include file="includes/nav.html" --> PHPCode <?php include("includes/nav.html"); ?> JavaScriptCode <script src="includes/nav.js"></script> (With JavaScript though, some search engines might not be able to read it and I do not recommend it. This should be used only if your server cannot support SSI, ASP, PHP and / or you need to keep your html extensions on your files.)
With the server side the file is parsed on the server before being rendered in the browser. The nav.html would have your code that is your navigation only - for example:
Code | <a href="/default.asp">Home</a> | <a href="/about.asp">About</a> | <a href="/contact.asp">Contact</a> | And that would be it - nothing else is needed since everything else will be pulled from the main page that is calling for the included content.
With the JavaScript, you it would be a bit different, you would save this as nav.js: Code <!-- document.writeln("| <a href=\"/default.asp\">Home</a> | <a href=\"/about.asp\">About</a> | <a href=\"/contact.asp\">Contact</a> |"); //--> and then call it in the page like this: Code <script src="includes/nav.js"></script> however, some search engines do not read JavaScript since it is a client side language is (if by chance) the user has JavaScript disabled, then they would not see the JavaScript.
And for ASP.NET (ASPX) file Code <% Response.WriteFile ("Yourfile.inc") %>
For the type of hyperlinks check out types of hyperlinks - I would recommend using Virtual if you do use the server side includes.
Check with your hosting company to see what server side includes they will support.
__________________ Corey
Expression Web Blog | My Merchant Account Blog | 800 Numbers
|