Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy menu to all pages in site 2

Status
Not open for further replies.

tg2003

IS-IT--Management
Feb 6, 2003
270
IL
Hi,

I'm working on a new menu (tool-bar) in my site. Here it is:

I would like to know if I can use it as a function in all other site pages. What I mean is to avoid of copying the menu code to each page.
I know it's possible if I'd use PHP - but since I'm using HTML - is it possible? and if so - how?

Thanks in advance!
 
Put the menu code in a text file and put an include at the top of each page to call it.

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "[URL unfurl="true"]http://www.w3.org/TR/html4/strict.dtd">[/URL]
<html>

<head>
<title>Page Title</title>

<!--  #include file="navigation.txt" --> 

rest of page

navigation.txt look like:

Code:
stylesheet link
scripts
</head>
<body>
nav
 
Hi

Just a couple of words in addition to BigRed1212's suggestion.

In case you want to search for more about it, that is called SSI ( Server Side Includes ). So your web server has to be configured to parse the requested files for such code.

The SSI syntax is mostly common across web servers, but occasionally may differ. Generally there must be no space between the opening comment and the hash mark ( # ) :
Code:
<!--#include file="navigation.txt" -->

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top