HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
Included Content
Post new topic   Reply to topic    HTML Help Forum Index -> HTML FAQ
View previous topic :: View next topic  
Author Message
Corey Bryant
Site Admin


Joined: 15 May 2004
Posts: 8203
Location: Castle Rock CO USA

PostPosted: Sat Mar 04, 2006 3:27 pm     Included Content Reply with quote



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
Site Admin


Joined: 15 May 2004
Posts: 8203
Location: Castle Rock CO USA

PostPosted: Tue Jan 22, 2008 1:51 pm     Reply with quote

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


_________________
Corey
Residential Office Solutions | Mile High Merchant Accounts | Expression Web Blog
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> HTML FAQ All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial