Forum Moderators: coopster

Message Too Old, No Replies

php include in html pages

         

bheybugarin

3:02 am on Dec 13, 2008 (gmt 0)

10+ Year Member



Hi,

Currently, Im using the following code in htaccess:

AddType text/html .html .htm .php
AddHandler server-parsed .html .htm .php
AddHandler application/x-httpd-php .php .html .htm

and supported by php.ini with this code:

allow_url_include = On

-
Just want to know whats the best way to have php include in html pages and other possibilities.

bheybugarin

3:04 am on Dec 13, 2008 (gmt 0)

10+ Year Member



Other hosting provider advise me to use:

php echo file_get_contents

instead of php include

-
Any recommendations?

coopster

10:05 pm on Dec 14, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Looks like you are specifically referring to pulling in html pages from external sites. Is that correct?

bheybugarin

12:16 am on Dec 15, 2008 (gmt 0)

10+ Year Member



either external or internal includes

coopster

2:00 pm on Dec 15, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I typically use require_once [php.net] but that is how my applications are designed. If I cannot include the file specified, I really cannot continue processing and delivering the resource requested.

As far as this section ...

AddType text/html .html .htm .php 
AddHandler server-parsed .html .htm .php
AddHandler application/x-httpd-php .php .html .htm

You are merely telling your server to map the given filename extensions onto the specified content type (AddType) or map the filename extensions to the specified handler.

The AddHandler for PHP today depends on your server setup and PHP install type, but typically all you need is something along the lines of ...

AddHandler php5-script php htm html