Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. Include an HTML File into an another html file.

Include an HTML File into an another html file.

Scheduled Pinned Locked Moved Web Development
htmldatabasehelp
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    swornavidhya_m
    wrote on last edited by
    #1

    I've created a seperate html files for navigation, content and footer. I want to club those files. All the navigation, content, footer files resides in the same directory where the index.html file resides. I want to include the above mentioned html files inside the index.html. I have tried using the following in index.html file

    <!--#include virtual="topbanner.html" -->

    I also tried using the asp code which also fails. I tried with asp by changing all the html file extensions as .asp. Then i tried to place the following asp code in index.asp file as

    <!--#include file="topbanner.asp" -->

    Kindly solve my problem. This is an urgent thing to do for me.

    M.Sworna Vidhya

    P C T 3 Replies Last reply
    0
    • S swornavidhya_m

      I've created a seperate html files for navigation, content and footer. I want to club those files. All the navigation, content, footer files resides in the same directory where the index.html file resides. I want to include the above mentioned html files inside the index.html. I have tried using the following in index.html file

      <!--#include virtual="topbanner.html" -->

      I also tried using the asp code which also fails. I tried with asp by changing all the html file extensions as .asp. Then i tried to place the following asp code in index.asp file as

      <!--#include file="topbanner.asp" -->

      Kindly solve my problem. This is an urgent thing to do for me.

      M.Sworna Vidhya

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      Is it a full html file that you're trying to include? If so, this will cause you a problem as you should only try and import the relevant elements, and not the full page. BTW - convention seems to be to use .inc extension for include files.

      I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be

      Forgive your enemies - it messes with their heads

      My blog | My articles | MoXAML PowerToys | Onyx

      1 Reply Last reply
      0
      • S swornavidhya_m

        I've created a seperate html files for navigation, content and footer. I want to club those files. All the navigation, content, footer files resides in the same directory where the index.html file resides. I want to include the above mentioned html files inside the index.html. I have tried using the following in index.html file

        <!--#include virtual="topbanner.html" -->

        I also tried using the asp code which also fails. I tried with asp by changing all the html file extensions as .asp. Then i tried to place the following asp code in index.asp file as

        <!--#include file="topbanner.asp" -->

        Kindly solve my problem. This is an urgent thing to do for me.

        M.Sworna Vidhya

        C Offline
        C Offline
        cjoki
        wrote on last edited by
        #3

        The only way I can think to do it outside of something serverside would be to use javascript with a document.write()....maybe this will help http://www.cryer.co.uk/resources/javascript/script4.htm[^] I would use php to do what you want on the server side of the fence. PHP has a number of related function like include() that I use to seperate my html output into different sections. I do this by making a number of small php files like.... header.php menu.php footer.php these can all contain the basic html output like this example header.php ----------- <html> <head> <title>My Site</title> <body> .....end header.php AND menu.php ------------- <div> <ul class='menu'> <li><a href=''>Link 1</a></li> <li><a href=''>Link 2</a></li> </ul> </div> hope that helps... AND footer.php ------------- </body> </html> ......end footer.php NOW you just call these from a page script like this. index.php -------------- include('header.php'); include('menu.php'); // start page content.... // end page content.... include('footer.php');

        1 Reply Last reply
        0
        • S swornavidhya_m

          I've created a seperate html files for navigation, content and footer. I want to club those files. All the navigation, content, footer files resides in the same directory where the index.html file resides. I want to include the above mentioned html files inside the index.html. I have tried using the following in index.html file

          <!--#include virtual="topbanner.html" -->

          I also tried using the asp code which also fails. I tried with asp by changing all the html file extensions as .asp. Then i tried to place the following asp code in index.asp file as

          <!--#include file="topbanner.asp" -->

          Kindly solve my problem. This is an urgent thing to do for me.

          M.Sworna Vidhya

          T Offline
          T Offline
          T M Gray
          wrote on last edited by
          #4

          How does it fail? Does it cause an error? Have you checked to make sure your server is configured to handle SSI? I thought that html files had to end with .stm in order to get IIS to parse the includes.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups