hi, i'm entry level webdesigner- following the advice of youtube tutorial "rrphillps" of serverside includes. http://www.youtube.com/user/rrphillips?blend=2&ob=1#p/u/143/9TrsRxFtgSA

really simple stuff; the idea is to put all your hyperlinks in an ".inc" file and link all your webpages to it.

but then he explains that your server needs to know to look for php scripts in ".html /.htm" files, so either we need to rename ".html" as ".phtml" or to create a simple ".htaccess" file that says
"AddType php-cgi .html .htm"

but i can only get the ".phtml" format to work for me.

my ".html" doc doesn't show the hyperlinks included in the ".inc " file.

ralph suggests that the html format is better & i'd like to know why i can get this to work on my server.

i thought it might have something to do with "appache handlers" but i really don't have a clue... thanx for your help

Recommended Answers

All 4 Replies

There are two ways to do the .htaccess depending how php is set up:

For web servers using PHP as apache module:
AddType application/x-httpd-php .html .htm

For web servers running PHP as CGI:
AddHandler application/x-httpd-php .html .htm

The syntax is a bit different than what you had but the main thing is that only one of them will work depending on the setup. You can try both and see what works.

There are two ways to do the .htaccess depending how php is set up:

For web servers using PHP as apache module:
AddType application/x-httpd-php .html .htm

For web servers running PHP as CGI:
AddHandler application/x-httpd-php .html .htm

The syntax is a bit different than what you had but the main thing is that only one of them will work depending on the setup. You can try both and see what works.

hi thanx for your help, i've tried both, individually, to no avail. :o(

.htaccess
ASCII text, with no line terminators
AddHandler application/x-httpd-php .html .htm

.htaccess
ASCII text, with no line terminators
AddType application/x-httpd-php .html .htm

both uploaded to the same public_html folder where the referenced .html page is

hello again,
well i guess i've solved my problem of not getting php code to run in an html file. i wasn't able to get either of the scripts (that "chrishea" kindly offered) to work. when i called my hosting account and explained the problem the person suggested that there was nothing wrong with using ".phtml", and i should use that. what i will be using, and should have been using from the very beginning, is a ".php" extention.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.