include HTML file in another HTML file

T

Tom

Using Dreamweaver 8

Have 50+ html files all with same header, menus etc. Trying to use
#include to consolidate

Created an html file for my menus which just has table and div tags
for the header and menu bar - no html or body tags.

File looks good in DW and browser

Deleting header and menu code from index.html and inserting <!--
#include file="menu.html"--> after <body>

Looks good in DW but the menu html is not rendering when I test in the
brower - I get the body of index html with no header or menu

?

Thanks in advance...Tom
 
T

Toby A Inkster

Tom said:
Looks good in DW but the menu html is not rendering when I test in the
brower - I get the body of index html with no header or menu

Perhaps server-side includes are not configured correctly on your server?

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Geek of ~ HTML/SQL/Perl/PHP/Python*/Apache/Linux

* = I'm getting there!
 
C

Chris F.A. Johnson

Using Dreamweaver 8

Have 50+ html files all with same header, menus etc. Trying to use
#include to consolidate

Created an html file for my menus which just has table and div tags
for the header and menu bar - no html or body tags.

File looks good in DW and browser

Deleting header and menu code from index.html and inserting <!--
#include file="menu.html"--> after <body>

Looks good in DW but the menu html is not rendering when I test in the
brower - I get the body of index html with no header or menu

Try using index.shtml rather than index.html.
 
J

Jonathan N. Little

Tom said:
Using Dreamweaver 8

Have 50+ html files all with same header, menus etc. Trying to use
#include to consolidate

Created an html file for my menus which just has table and div tags
for the header and menu bar - no html or body tags.

File looks good in DW and browser

Deleting header and menu code from index.html and inserting <!--
#include file="menu.html"--> after <body>

Depending on your server config:

1) your file might have to be named *.shtml
2) insert with 'virtual': <!--#include virtual="menu.html" -->
 
D

dorayme

"Tom said:
Using Dreamweaver 8

Have 50+ html files all with same header, menus etc. Trying to use
#include to consolidate

Created an html file for my menus which just has table and div tags
for the header and menu bar - no html or body tags.

File looks good in DW and browser

Deleting header and menu code from index.html and inserting <!--
#include file="menu.html"--> after <body>

Looks good in DW but the menu html is not rendering when I test in the
brower - I get the body of index html with no header or menu

?

Thanks in advance...Tom

Are you running a server?
 
T

Tom

Are you running a server?

The code was right but I was testing locally...when I changed to ASP I
realized I had to move them over to test.

Now what I need to do...

When the menu code was in each html file I would change the color of
the menu header that was current...i.e., if they click a sub topic
under the About menu I would change the color of About from blue to
"white"...Now that my menu code is included how can I affect attribute
changes...can it be done by using the ID...our menus are table
combined with CSS

Each menu topic is in a <td> tag with an ID.


Thanks...
 
D

dorayme

The code was right but I was testing locally...when I changed to ASP I
realized I had to move them over to test.

How does this answer the question I asked you?
Now what I need to do...

Like the rest is now settled? And we move on to something else?
Phew... did you see that: the rabbit rushing past shouting "It's
late, it's late, it's half past eight...

Yes, we are with Alice down in Wonderland... and I have to say,
it is most refreshing and nice to be here...

When the menu code was in each html file I would change the color of
the menu header that was current...i.e., if they click a sub topic
under the About menu I would change the color of About from blue to
"white"...Now that my menu code is included how can I affect attribute
changes...can it be done by using the ID...our menus are table
combined with CSS

Each menu topic is in a <td> tag with an ID.

It's late, it's late, it's half past eight... I'd say to tag the
click and colour the code, menu the header and ID the node...
 
T

Tom

How does this answer the question I asked you?


Like the rest is now settled? And we move on to something else?
Phew... did you see that: the rabbit rushing past shouting "It's
late, it's late, it's half past eight...

Yes, we are with Alice down in Wonderland... and I have to say,
it is most refreshing and nice to be here...



It's late, it's late, it's half past eight... I'd say to tag the
click and colour the code, menu the header and ID the node...

I was remiss that when I said that I "moved them over" - I did not
specifically add "to the server"...Now perhaps you would reciprocate
and specify exactly what you mean...code sample would help greatly...
 
A

Adrienne Boswell

I was remiss that when I said that I "moved them over" - I did not
specifically add "to the server"...Now perhaps you would reciprocate
and specify exactly what you mean...code sample would help greatly...

I'm being generous today... this is what I do and it works very well.

On the top of every page:
<% option explicit
thispage = "page title"
thisurl = "example.asp"
%>
....
<title><%=thispage%></title>
</head>
<body>
<h1><%=thispage%></title>
....
</body>


In nav_inc.asp:

<% pagelist = "Home, About, Contact"
urllist = "index.asp, about.asp, contact.asp"
pagearr = split(pagelist,", ")
urlarr = split(urllist,", ")
%>
<ul>
<%
for i = 0 to ubound(pagearr)
<%=navlist(pagearr(i),urlarr(i))%>
next
%>
</ul>

<%

function navlist(page,link)

if thispage = link then
navlist = "<li><a href=" & chr(034) & link & chr(034) & " class="
& chr(034) & "currentpage" & chr(034) & ">" & page & "</a></li>"
else
navlist = "<li><a href=" & chr(034) & link & chr(034) ">" & page &
</a></li>"
end if

end function
%>

The reason you want to use class here instead of id is because you may
have to use the same menu elsewhere on the page, and an id can only be
used once.
 

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

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,119
Latest member
IrmaNorcro
Top