Same Menu On Every Page

M

Matt White

I am creating a page with 2 <div>'s - one is a menu and one holds the
page content. The menu is the same on every page. What is the best way
to get the HTML for the menu on every page without putting the full
source on every page? I'd rather have a separate menu.html file that
gets loaded into the menu <div> when each page loads. Thanks.
 
D

dorayme

"Beauregard T. Shagnasty said:

I sometimes wonder what other folks do in regard to the includes,
do they put in all the enclosing element markup within the
include or leave the container explicit in the html file to
remind the author how the include goes. I tend to go the greedy
route and put all in the include. This is to show high wire
courage in the face of a creeping dementia.
 
B

Beauregard T. Shagnasty

dorayme said:
I sometimes wonder what other folks do in regard to the includes, do
they put in all the enclosing element markup within the include or
leave the container explicit in the html file to remind the author
how the include goes. I tend to go the greedy route and put all in
the include. This is to show high wire courage in the face of a
creeping dementia.

I place everything in the include file that goes with that object. Can't
see any reason to have to remember to add containers or whatever to the
main file. Just add the 'include' line.
 
D

dorayme

"Beauregard T. Shagnasty said:
I place everything in the include file that goes with that object. Can't
see any reason to have to remember to add containers or whatever to the
main file. Just add the 'include' line.

In that case I am in good company - never mind that I do it with
attitude whereas you do it with plain and calm reason. <g>
 
B

Bernhard Sturm

Beauregard said:
I place everything in the include file that goes with that object. Can't
see any reason to have to remember to add containers or whatever to the
main file. Just add the 'include' line.
sometimes it's easier to have just the actual content in the included
file, and to leave all the containers in the main file. If you follow
the idea of an 'include' you will most probably end up with this
solution: the container will not change, but the included content might
change (if you dynamically include files). Therefore you only have to
define the containers once (in the main file), and the included pages do
only contain content information. This has another advantage: it's
easier to edit such a 'container-less' page width a WYSIWIG-editor such
as dreamweaver and the like in a 'non-cms-environment' where less
experienced users are uploading only content-pages via FTP...

but there are many roads to choose :)

bernhard
 
N

Neredbojias

Well bust mah britches and call me cheeky, on Fri, 10 Aug 2007 10:15:50 GMT
Bernhard Sturm scribed:
sometimes it's easier to have just the actual content in the included
file, and to leave all the containers in the main file. If you follow
the idea of an 'include' you will most probably end up with this
solution: the container will not change, but the included content might
change (if you dynamically include files). Therefore you only have to
define the containers once (in the main file), and the included pages do
only contain content information. This has another advantage: it's
easier to edit such a 'container-less' page width a WYSIWIG-editor such
as dreamweaver and the like in a 'non-cms-environment' where less
experienced users are uploading only content-pages via FTP...

but there are many roads to choose :)

Ultimately, a container is _always_ left in the receiving file.
 
D

dorayme

Bernhard Sturm said:
sometimes it's easier to have just the actual content in the included
file, and to leave all the containers in the main file. If you follow
the idea of an 'include' you will most probably end up with this
solution: the container will not change, but the included content might
change (if you dynamically include files). Therefore you only have to
define the containers once (in the main file), and the included pages do
only contain content information. This has another advantage: it's
easier to edit such a 'container-less' page width a WYSIWIG-editor such
as dreamweaver and the like in a 'non-cms-environment' where less
experienced users are uploading only content-pages via FTP...

but there are many roads to choose :)

True about the roads and an interesting point about editing. I am
not quite sure about the point re Dreamweaver though? If one has

<div id="nav">

include command

</div>

This is a container road, right?
 
B

Bernhard Sturm

dorayme said:
True about the roads and an interesting point about editing. I am
not quite sure about the point re Dreamweaver though? If one has

<div id="nav">

include command

</div>

This is a container road, right?

yes. that's the road I usually take :)
assuming you would have such a construct in the main file:

<div id="content-container">
dynamically include content depending on menu context
</div>

the include file would then simply look like this:

<h2>Content only</h2>
<p>Paragraph with content</p>

This is much easier to maintain by someone who uses dreamweaver (or a
very simple WYSIWYG-editor) and who is only editing the content
includes. He or she will only see pure content markup no (probably)
confusing div holding it together as all containers are located in a
single file (the main file) and not distributed in various other content
files which makes my life as a webdesigner easier :)

cheers
bernhard
 

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,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top