...

View Full Version : Including external HTML



Taro
06-14-2012, 07:22 PM
Hello,

What are some ways to include external HTML in a webpage?

I'm not sure about the commercial usability
of this code: <?phpinclude("external_file.html");?>

The reason is that the coding of the file of my FTP server must be with additional extension files, and changing the location of the webpage deactivates and alters the function of the coding (this is probably not normal). Moreover, I will also consider the use of using I-frames.

jimutt
06-14-2012, 07:28 PM
The php include function is the method used by almost all websites (both private and commercial) that needs to include external files. So I would suggest you to continue using that function if your server supports PHP.

Though you need to put a space between the first <?php and "include" so that it will be <?php include("external_file.html");?>

But depending on the content of the HTML file which need to be included it could also be possible for you to get it through an <iframe>. The iframe tag is explained here: http://w3schools.com/html/html_iframe.asp

Taro
06-14-2012, 07:46 PM
I tried using the PHP code, but I guess my sub-domain provider does not allow custom PHP scripting. The <iframe/> works very well. I will also consider the use of JavaScript methods, in case some people don't like using <iframes/>.

VIPStephan
06-14-2012, 07:47 PM
Better than an iframe is the object element (http://joliclic.free.fr/html/object-tag/en/index.php). And without the need to support IE 6 implementation should be fairly consistent across browsers.

Keleth
06-14-2012, 08:28 PM
Rather then use either (I always recommend against iframes, though object is something I haven't explored), use the SSI <!--#include virtual="path to file/include-file.html" -->.

But I would also check with your host, as I haven't run across even a basic host that doesn't include PHP or ASP (some server side tech)... can't really do much with the web without some server site language.

Taro
06-18-2012, 11:42 PM
Rather then use either (I always recommend against iframes, though object is something I haven't explored), use the SSI <!--#include virtual="path to file/include-file.html" -->.

But I would also check with your host, as I haven't run across even a basic host that doesn't include PHP or ASP (some server side tech)... can't really do much with the web without some server site language.

The reason being is that sub-domain has their own forum and membership applications, and does not require any additional scripting, unless it is a widget made by a third-party.

Anyways I have not heard of the SSI, as I don't see it within the source code of the page.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum