homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

insert HTML code from file into HTML page

5+ Year Member

Msg#: 3767439 posted 10:44 pm on Oct 16, 2008 (gmt 0)

I have around 100 web pages on a site. Most of these pages are the same, except for some HTML.

I'd like to #include the complex, bulk HTML from a file into each page, so that I can easily change the bulk HTML in one place and have it "appear" when the other pages get loaded into a browser.

The bulk HTML has seven <div's> in it, some with tables and text and images, etc.

I cannot use PHP or server-side scripting to php-include etc, because this has to run offline.

I tried using:

<object type="text/html" data="myFile.htm"></object>

but it doesn't place the clean HTML cleanly into the page -- it appears in some kind of scrolling div or something.

I also tried using the DOM to create a text node, but couldn't get the div's in the bulk file to actually appear in the page.

Any ideas?




WebmasterWorld Senior Member 5+ Year Member

Msg#: 3767439 posted 2:35 am on Oct 17, 2008 (gmt 0)

Run PHP offline in batch mode to produce static pages maybe ?


5+ Year Member

Msg#: 3767439 posted 7:47 am on Oct 17, 2008 (gmt 0)

I did have the <object> solution working yesterday, but I must have changed something, somewhere, because it doesn't work anymore (not that it's very complex).

What I see now when I look at the page source in the browser is:

<object data="foo.htm">

whereas before, when it worked, I saw the expaned foo.htm inline in the page code.

Go figure.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved