Include an HTML File into an another html file.
-
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
-
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
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
-
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
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');
-
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