SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Zealot
    Join Date
    Aug 2006
    Location
    Sydney, Australia
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Red face Including one html document content in another document

    I have three documents

    header.html

    footer.html

    and

    index.html

    I'm trying to include the contents of header.htmlk in index.html, to get on top of that single change for entire site goodness

    Okay I know I can do this with ColdFusion, but at this stage the beta site will be static. Is there an include method in standard html/css or do I have to bite the bullet and start the scripting early?

    Cheers, thanks in advance, and stuff like that.
    www.scaryminds.com ScaryMinds - horror's last colonial outpost.

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,786
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    You could use Server Side Includes if that is enabled - or any server side scripting language.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Server-side includes won't work if all three files are complete HTML-documents. In that case you'll have to use frames (which have been deprecated for more than 10 years).

    A better solution, of course, is to make the header and footer into include files and use server-side includes. Of course, that requires that the server supports SSI. If not, you're back to frames.
    Birnam wood is come to Dunsinane

  4. #4
    SitePoint Member
    Join Date
    Oct 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I can do this with ColdFusion, but at this stage the beta site will be static. Is there an include method in standard html/css or do I have to bite the bullet and start the scripting early?

  5. #5
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, there is no include method in HTML (and CSS is only for presentation).

    In theory you should be able to use object elements, but that won't work very well. Another poor solution, which is also deprecated, is iframe.

    You'll need to script this eventually, so I'd recommend doing that from the outset.
    Birnam wood is come to Dunsinane

  6. #6
    SitePoint Wizard
    Join Date
    Jul 2003
    Location
    Kent
    Posts
    1,921
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Dreamweaver's template system allows you to create pages where editing the master template then updates all pages based on it. But then you have to upload them all, which probably isn't exactly what you'd want.

    Using PHP and PHP includes will work however.

  7. #7
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,786
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Dr John View Post
    Using PHP and PHP includes will work however.
    Since the original poster mentioned ColdFusion they are probably better off using that scripting language rather than PHP.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  8. #8
    SitePoint Zealot
    Join Date
    Aug 2006
    Location
    Sydney, Australia
    Posts
    171
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay thanks for the replies, time to dust off eclipse/dreamweaver and start coding. Seems slightly strange to be chucking in scripting for exactly two lines, but guess dem is the rules

    Thanks for the replies.
    www.scaryminds.com ScaryMinds - horror's last colonial outpost.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •