Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder Taro's Avatar
    Join Date
    Oct 2011
    Location
    Geraldton, Ontario
    Posts
    155
    Thanks
    1
    Thanked 1 Time in 1 Post

    Including external HTML

    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.
    Element ID

    Webs Support Helper

    Your friendly neighborhood Taroman.

  • #2
    New Coder
    Join Date
    Sep 2011
    Posts
    47
    Thanks
    1
    Thanked 15 Times in 14 Posts
    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
    Last edited by jimutt; 06-14-2012 at 06:32 PM.

  • #3
    Regular Coder Taro's Avatar
    Join Date
    Oct 2011
    Location
    Geraldton, Ontario
    Posts
    155
    Thanks
    1
    Thanked 1 Time in 1 Post
    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/>.
    Element ID

    Webs Support Helper

    Your friendly neighborhood Taroman.

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,672
    Thanks
    6
    Thanked 1,006 Times in 979 Posts
    Better than an iframe is the object element. And without the need to support IE 6 implementation should be fairly consistent across browsers.

  • #5
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,536
    Thanks
    45
    Thanked 259 Times in 256 Posts
    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.

  • #6
    Regular Coder Taro's Avatar
    Join Date
    Oct 2011
    Location
    Geraldton, Ontario
    Posts
    155
    Thanks
    1
    Thanked 1 Time in 1 Post
    Quote Originally Posted by Keleth View Post
    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.
    Element ID

    Webs Support Helper

    Your friendly neighborhood Taroman.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •