|
For those who want a dynamic site, I'll show you how to do it in PHP, ASP, Cold Fusion or Java. Check with your host to see which of these is available.
The really nice thing about using Header and Footer Include Files is when you change the include files, it changes every page on your site:
For PHP:
Start by changing index.htm to index.php. Then use this code:
<?php
include 'includes/header.php';
?>
add all of your body text, tables, pictures, etc. here (just regular html. cut and paste from your old page if you like)
<?php
include 'includes/footer.php';
?>
Next, create header.php and footer.php and place them in a folder called "includes". In the header file, add your page title and navigational links. In the footer file, add your copyright notice.
To create new pages keep using the above code.
When you want to update links in the header or the copyright date in the footer, all you have to do is change one file, not the whole site.
For ASP:
Same as above but each page with includes should start with:
joined:Sept 28, 2001
posts:349
msg #:3 10:01 pm on Apr 17, 2003 (utc 0)
And in ASP...
<%@ Language=VBScript %>
<% Option Explicit %>
Then use this code for the includes:
<!-- #include virtual="/Includes/header.asp" -->
add your content here
<!-- #include virtual="/Includes/footer.asp" -->
For JSP
Use this code for the includes:
<%@ include file="header.jsp" %>
content goes here
<%@ include file="footer.jsp" %>
For Cold Fusion
Use this code for the includes:
<CFINCLUDE TEMPLATE = "../includes/header.htm">
body here
<CFINCLUDE TEMPLATE = "../includes/footer.htm">
After you get used to doing this you can include files that run programs on the server and then output information. For example, you might want to output random links from your forum, so you create a program that randomly selects from a list of forum posts and then outputs the html to the include. Switching your site to .php extensions (or .jsp or .cfm or .asp) and starting to use headers and footers is the first step into the wonderful world of building dynamic websites!
|