Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Nov 2009
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    html file in to another html file

    I have a problem in html. does any body know how to include the html file in another html file.

  • #2
    New Coder
    Join Date
    Jun 2008
    Posts
    76
    Thanks
    11
    Thanked 0 Times in 0 Posts
    Can you explain in more detail what you're trying to achieve?

  • #3
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm actually glad to hear I'm not the only one. This was driving me CRAZY the other day. I used to do this all the time (that is, I used to use HTML's means of including files inside other files) and now I can't seem to do it. I wound up converting my pages to PHP just to be able to do includes.

    The way I was trying to do it was like this:

    <!--#include file="folder/filename.html"-->

    And that would not work. I also tried replacing "file" with "virtual".

    When I did this successfully at an old job, it was ASP pages being included inside other ASP pages, but it was using HTML to do the including, just like in the example above.

    Good luck, and I will keep an eye on this thread. I hope you find an answer.

  • #4
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Quote Originally Posted by briansmccabe View Post
    I'm actually glad to hear I'm not the only one. This was driving me CRAZY the other day. I used to do this all the time (that is, I used to use HTML's means of including files inside other files) and now I can't seem to do it. I wound up converting my pages to PHP just to be able to do includes.

    The way I was trying to do it was like this:

    <!--#include file="folder/filename.html"-->

    And that would not work. I also tried replacing "file" with "virtual".

    When I did this successfully at an old job, it was ASP pages being included inside other ASP pages, but it was using HTML to do the including, just like in the example above.

    Good luck, and I will keep an eye on this thread. I hope you find an answer.
    Was the extension .shtml? The server needs this in order to process it.

  • #5
    New Coder
    Join Date
    Dec 2009
    Posts
    11
    Thanks
    0
    Thanked 1 Time in 1 Post

    htaccess to parse html as shtml

    I added a couple of lines to my htaccess file to have my html files parsed as shtml. Since I have navigation (and footer) includes on all my pages, this brings them in without introducing the filename extension of shtml to my users. Here are the lines I use:

    AddType text/html .html
    AddHandler server-parsed .html

    Be very careful when editing your htaccess file. You can throw your whole website into a tizzy if you goof up.

    I usually copy my original over to a notepad while I am making changes so I can immediately copy it back in if I mess something up.

    Then you can use your include statement in this format:

    <!--#include file="folder/filename.html"-->

    Weaver
    Last edited by weaver; 12-03-2009 at 05:35 PM. Reason: adding instruction on include statement

  • #6
    New Coder
    Join Date
    Nov 2009
    Posts
    22
    Thanks
    0
    Thanked 0 Times in 0 Posts

    including html file into html file

    Thanks for giveing quick reply.

    I tried that but its not working in html.

    if I use the PHP it will work?

  • #7
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    If you chance your file extension to .php and use PHP code (the include() or require() function) then yes, it'll work.


  •  

    Posting Permissions

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