frames alternative for main menu?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I want to make a website with a global menu on one side that then brings
content up in another part of the window.  One way to do this is with
frames.  Another way is to have every single page on the site have the
same menu.  However, that means that adding a menu item for a new page on
the site requires editting all the pages.  I am trying to stay clear of
frames because lots of people harp on them for various reasons.

I thought there was some style sheet command that generates html code as
it is interpreted.  I figured I could use a style sheet file to generate
and position the menu items on the page.  Every page would read in the
style sheet, but if I want to modify the menu I only have to change how it
is constructed on the fly by the style sheet.

I though the style sheet command was something like "write", but now I
can't find any reference to it.

Is this the right way to do this?  If so, what is that "write" command,
and how is it used?


Keith Wiley                      

"Yet mark his perfect self-contentment, and hence learn his lesson,
that to be self-contented is to be vile and ignorant, and that to
aspire is better than to be blindly and impotently happy."
                                           --  Edwin A. Abbott, Flatland

Re: frames alternative for main menu?

Quoted text here. Click to load it

And they are good reasons, beleive me.

Quoted text here. Click to load it

You're thinking of javascript, document.write "some text";.  But that's
going to be a problem for visitors without javascript, including search

What you want to do is called Server Side Include, and depends on what your
host provides, SSI, PHP, ASP, etc.  

*** template.shtml ***
 " ">
<title><!-- Your title here --></title>
<link type="text/css" rel="stylesheet" href="mystyle.css">
<div id="menu">
<!--#include file="" -->
<div id="content">
Your content here

*** ***
<li><a href="index.shtml">Home</a></li>
<li><a href="contact.shtml">Contact</a></li>

*** mystyle.css ***
#menu {float:left; width:15%}
#content {margin-left: 15%}

Play around with the styling to suit, but this is a basic template.  You
only have to change when you want to add/remove items.

Adrienne Boswell
Please respond to the group so others can share

Re: frames alternative for main menu?

Keith Wiley wrote:
Quoted text here. Click to load it

If you are on Linux or Unix, you can use
the cat command of the shell
as a preprocessor in a one-liner
to concatinate a number of
carefully structured text files:

cat header.txt menu.txt content.txt footer.txt > finished.html

A lot of more complex preprocessors are available for free download,
but cat may be all you'll need.

Almost any programming language can be used to write a preprocessor
in not very many lines.  Perl is particularly easy.

For online work, investigate server side includes and generated pages
by Perl or PHP.

Cheers, m   at
...via Tux and Ice -- 0% GatesBloat

Re: frames alternative for main menu?

Quoted text here. Click to load it

You're thinking of "generated content" but it's inappropriate for this
purpose because style sheets are always supposed to be optional (its proper
use is for things like putting the URL next to a link on printed versions
of a document).  Also, browser support for generated content is pretty poor
at the moment.

Some sort of inclusion mechanism, whether dynamic (as in the server-side-
include example another poster gave) or static (achieved by preprocessing)
is the proper solution to your problem.

Re: frames alternative for main menu?

Keith Wiley wrote:

Quoted text here. Click to load it

Shame, it would be better if you avoided them becuase you agree that those
reasons are worthy.

Quoted text here. Click to load it

No, the only features CSS has to generate content are designed for small
things (such as displaying the value of an attribute after it, for example:

a[href^="http:"]:after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        vertical-align: middle;

... which I use in some of my print media style sheets)

Quoted text here. Click to load it

There is a write() function/method/whateverJScallsThem in JavaScript, but
that is probably a worse choice to handle includes then frames.

Have a read of

David Dorward                              /

Site Timeline