HTML Help Forum Index HTML Help
Please Search for the answer to your question before asking it! Thanks.
 

Included Content
Post a Reply to this Topic Ask a New Question
Click here to go to the original topic
       HTML Help Forum Index -> HTML FAQ
View previous topic :: View next topic  
Author Message


Corey Bryant



Joined: 15 May 2004
Posts: 8428
Location: Castle Pines North, CO USA

Posted: Sat Mar 04, 2006 3:27 pm     Included Content  

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 - Frames Tutorial

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" -->
ASP Code: <!--#include file="includes/nav.html" -->
PHP Code: <?php include("includes/nav.html"); ?>
JavaScript Code: <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.

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
Toll Free Fax Numbers | Merchant Accounts
Corey Bryant



Joined: 15 May 2004
Posts: 8428
Location: Castle Pines North, CO USA

Posted: Tue Jan 22, 2008 1:51 pm      

And for ASP.NET (ASPX) file Code: <%         
   Response.WriteFile ("Yourfile.inc")
%>

_________________
Corey
Residential Office Solutions | Mile High Merchant Accounts | Expression Web Blog
 
 
HOSTING / DESIGN
MAKE MONEY

       HTML Help Forum Index -> HTML FAQ
Page 1 of 1


Powered by phpBB Search Engine Indexer
Powered by phpBB 2.0.19 © 2001, 2002 phpBB Group