1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Including one HTML file in another

Discussion in 'HTML & Website Design' started by ademmeda, Jun 4, 2011.

  1. #1
    Hi,

    I have two pages(page1.html and page2.html) on my site that both have an identical section which I will be updating frequently. I want to create a html file(section.html) for that section and include in page1 and page2 so that I will have to modify only 1 file(section.html).

    I searched the web and I found that this could be done by SSI(Server-Side Includes) such as

    <!--#include file="section.html" -->
    Code (markup):
    And I also learned that I need the server must be enabled for SSI and the file extensions should be .shtml like page1.shtml and page2.shtml.
    SEMrush
    My server seems not to allow SSI and I was wondering if there is another approach for my problem.

    Thanks.
     
    ademmeda, Jun 4, 2011 IP
    SEMrush
  2. Zetiz

    Zetiz Active Member

    Messages:
    668
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    80
    #2
    why don't u try updating your page extensions to .php and then try
    <?php include(section.php); ?>
    Code (markup):
    I think this will surely solve your problem.

    Regards
     
    Zetiz, Jun 4, 2011 IP
  3. ademmeda

    ademmeda Active Member

    Messages:
    354
    Likes Received:
    3
    Best Answers:
    3
    Trophy Points:
    70
    #3
    Only if PHP was enabled on the server. Then I wouldn't ask this question.
     
    ademmeda, Jun 4, 2011 IP
  4. wertheim

    wertheim Guest

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    in the old days they would use FRAMES. You might want to experiment by practicing with frames. It can be kind of fun to create framesets. From there they used iframes which is a way to seamlessly stitch two or more html pages together and make it look like one page. You can even make a window show up in a middle of a page with different content from another page or another site in.

    the state of the art these days is to do everything with php, which in truth is not that hard to learn and can be fun to work with. there are lots of tutorials on it around. with php you can do a lot. you can put php into an html document, and you can put html into a php document. If you do this kind of think and you like it you might as well get used to creating all your projects in php rather than html. All browsers pretty much treat them the same. When you create your pages you just save them as *.php
     
    wertheim, Jun 5, 2011 IP
  5. ademmeda

    ademmeda Active Member

    Messages:
    354
    Likes Received:
    3
    Best Answers:
    3
    Trophy Points:
    70
    #5
    Surely I know the power of PHP and I work with PHP whenever my clients' hosting support PHP. But in this specific case, it doesn't and I need a solution other than PHP. I tried frames but it seems it is not the best option. Thanks for reminding iframes, I never worked with them, now I will try it.
     
    ademmeda, Jun 5, 2011 IP
  6. J4mmy

    J4mmy Greenhorn

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #6
    I have no idea on how to process with this but i hope you will find the solution as soon as possible :)
     
    J4mmy, Jun 5, 2011 IP
  7. subdivisions

    subdivisions Well-Known Member

    Messages:
    1,021
    Likes Received:
    40
    Best Answers:
    1
    Trophy Points:
    145
    #7
    Frames/iframes will complicate your SEO. Your client should really look into just installing PHP :/
     
    subdivisions, Jun 6, 2011 IP
  8. manish_khanna

    manish_khanna Member

    Messages:
    58
    Likes Received:
    6
    Best Answers:
    1
    Trophy Points:
    35
    #8
    1. try iframe , if that is not what you want. SSI is something just doesn't work that simple in dreamweaver there is a library object that way you can maintain both.
    or find a server have php and create php includes
     
    manish_khanna, Jun 6, 2011 IP