include HTML file in another HTML file

Discussion in 'HTML' started by Tom, Feb 12, 2007.

  1. Tom

    Tom Guest

    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
    Tom, Feb 12, 2007
    #1
    1. Advertising

  2. Tom wrote:

    > 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!
    Toby A Inkster, Feb 12, 2007
    #2
    1. Advertising

  3. On 2007-02-12, Tom wrote:
    > 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.

    --
    Chris F.A. Johnson <http://cfaj.freeshell.org>
    ===================================================================
    Author:
    Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
    Chris F.A. Johnson, Feb 12, 2007
    #3
  4. Tom wrote:
    > 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" -->




    --
    Take care,

    Jonathan
    -------------------
    LITTLE WORKS STUDIO
    http://www.LittleWorksStudio.com
    Jonathan N. Little, Feb 12, 2007
    #4
  5. Tom

    dorayme Guest

    In article
    <>,
    "Tom" <> wrote:

    > 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?

    --
    dorayme
    dorayme, Feb 12, 2007
    #5
  6. Tom

    Tom Guest

    On Feb 12, 3:13 pm, dorayme <> wrote:
    > In article
    > <>,
    >
    >
    >
    > "Tom" <> wrote:
    > > 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?
    >
    > --
    > 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.

    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...
    Tom, Feb 13, 2007
    #6
  7. Tom

    dorayme Guest

    In article
    <>,
    "Tom" <> wrote:

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


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

    --
    dorayme
    dorayme, Feb 13, 2007
    #7
  8. Tom

    Tom Guest

    On Feb 12, 10:25 pm, dorayme <> wrote:
    > In article
    > <>,
    >
    > "Tom" <> wrote:
    > > > 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.

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


    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...
    Tom, Feb 13, 2007
    #8
  9. Gazing into my crystal ball I observed "Tom" <>
    writing in news::

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

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

    --
    Adrienne Boswell at Home
    Arbpen Web Site Design Services
    http://www.cavalcade-of-coding.info
    Please respond to the group so others can share
    Adrienne Boswell, Feb 13, 2007
    #9
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Victor Bazarov

    #include "file" -vs- #include <file>

    Victor Bazarov, Mar 5, 2005, in forum: C++
    Replies:
    4
    Views:
    525
    Exits Funnel
    Mar 6, 2005
  2. PTM
    Replies:
    1
    Views:
    321
    Andy Dingley
    Nov 12, 2007
  3. naveeddil
    Replies:
    0
    Views:
    553
    naveeddil
    Jan 4, 2008
  4. Andreas Bogenberger
    Replies:
    3
    Views:
    888
    Andreas Bogenberger
    Feb 22, 2008
  5. ym
    Replies:
    0
    Views:
    141
Loading...

Share This Page