[wellylug] OT: HTML Question

jfouhy at paradise.net.nz jfouhy at paradise.net.nz
Mon Mar 7 12:16:49 NZDT 2005


Quoting Rob Giltrap <rob at kiwihq.com>:

> I have created a website http://www.onslowkids.wellington.net.nz/ and I
> want to separate the header and side menu bar in an "include" type 
> statement for ease of maintenance.

If the web server supports server side includes, you can use that.

You need to give your files the extension ".shtml".  Then you can use directives
like:

<!--#include virtual="myMenu.shtml" -->

to include other files.

You can also set and echo variables.  eg:

<!--#set var="title" value="My Web Page Title" -->

<html>
<head>
<title><!--#echo var="title"--></title>
...

Directives are just processed one after another, and there's just one scope, so
you can, for example, define a variable in one file, and then use it in another.
 In one website I maintain, I have (approximately) a menu.shtml file, which does:

<!--#set var="menu" value="
<a href=\"link1.shtml\">link1</a><br>
...
"-->

and then I have a "tail.shtml", which I include at the end of each page, which
lays out the title, menu, et cetera, using that variable.

See http://httpd.apache.org/docs/howto/ssi.html for some more docs.

HTH.

-- 
John.




More information about the wellylug mailing list