frames alternative for main menu?

K

Keith Wiley

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?

Thanks.

________________________________________________________________________
Keith Wiley (e-mail address removed)
http://www.unm.edu/~keithw http://www.mp3.com/KeithWiley

"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
________________________________________________________________________
 
A

Adrienne

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.

And they are good reasons, beleive me.
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?

Thanks.

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

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

*** template.shtml ***
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<head>
<title><!-- Your title here --></title>
<link type="text/css" rel="stylesheet" href="mystyle.css">
</head>
<body>
<div id="menu">
<!--#include file="menu.inc" -->
</div>
<div id="content">
Your content here
</div>
</body>


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


*** 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 menu.inc when you want to add/remove items.
 
M

m

Keith said:
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?

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.
 
E

Eric Bohlman

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?

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.
 
D

David Dorward

Keith said:
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.

Shame, it would be better if you avoided them becuase you agree that those
reasons are worthy.
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.

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)
I though the style sheet command was something like "write", but now I
can't find any reference to 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 http://www.allmyfaqs.com/faq.pl?Include_one_file_in_another
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,905
Latest member
Kristy_Poole

Latest Threads

Top