Ask Leo! by Leo A. Notenboom

How do I include one HTML file inside another?

Search First! Then browse: Categories | Full Archive | By Date | Newsletter

Home » Web » Web Site Management

Comments

Read the article that everyone's commenting on.
RSS feed Subscribe to the RSS Feed for comments on this article.

Comment Page:  1  |  2  |  3  |  4 

Check with your host - it may need to be enabled, or it may only be enabled for certain file extensions (like .shtml).

Posted by: Leo at June 11, 2006 3:24 PM

I use the code
as u mensioned. and also
tested.
in my main html page. but it doesn't work.
I want to include my common header in to all pages.
Please help me.
Thanks

Posted by: Mahesh at September 3, 2006 9:56 PM

dear Leo

i have got three files help.htm ,contact.php and ..inc
i have called the inc file inside teh php file
now i want to call this php file inside teh htm file , i.e when i click help.htm the contents of contact.php should called
i tried the below mentioned php tag on help.htm but all in vain. apprecaite your invaluable assistance

AXIS Engineering Consultants

Posted by: Kris at September 7, 2006 6:29 AM

That type of include (<?) needs to happen in a PHP file, you have it in an HTML file. You probably need to use SSI include. The style of include needs to match the type of source file, not the type of file being included.

Posted by: Leo Notenboom at September 7, 2006 11:36 AM

I've idea about how to write include syntax in a html file. http://www.seobbsr.com/

Posted by: T.ashok kumar at May 12, 2007 4:30 AM

Hi Leo, thanks for this informative article.

Suggestion to all those who want to include html in html and don't know much about servers, php and or ssi: Use the client-side method described here. It's easy and it works as long as Javascript is not disabled on the visitors browser. For this case you still can add this:
<noscript>Please enable Javascript in your Browsersettings!</noscript>

cheers

Posted by: jfk at May 25, 2007 7:29 AM

Thank-you for the helpful info on %includes.
I've used them in programming in other non-web languages (PL1, JCL PL/SQL etc), but not in web context.

Text at top/left of web pages often contributes to a page's ranking for search engines. If this text is removed, a menu for example, to a seperate document (by any of the described methods) will this likely mean the page has a lower ranking with such keyword text omitted?

Posted by: David Smith at July 29, 2007 2:19 AM

I READ THIS ARTICLE, IT DOESN'T HELP AT ALL FOR CLIENT SIDE SCRIPTS aka INCLUDING A FILE IN ANOTHER FILE...

HERE IS A VERY HELPFUL ARTICLE:

http://www.moock.org/webdesign/javascript/client-side-include/index.html

Posted by: HELPFUL at November 23, 2007 8:22 PM

I finally got my problem solved, which was not only a client side include, but a client side include where I had to calculate which include to include. (Did I make myself clear or what? ;-> )
I wanted to include the daily watchwords (see www.ebu.org) in my "Outlook Today" page.

This is my code (I hope it shows well):


function fuehrendeNull(wert)
{
if (wert")


If the cite-tags are showed, they are the ones which shouldn't show...
If it doesn't show at all or only very strange, my trick is to do a "document.write" that writes ANOTHER "script"-Statement, in which the variable is inserted.

Posted by: Volker at January 24, 2008 12:43 AM

Well, the code didn't show really well.
Here it is again, only with much less

Posted by: Volker at January 24, 2008 12:53 AM
Comment Page:  1  |  2  |  3  |  4 
Read the article that everyone's commenting on.
RSS feed Subscribe to the RSS Feed for comments on this article.
Post a Comment

To post a comment on "How do I include one HTML file inside another?", please return to that article's main page.

Question? Ask Leo!