How to adding PHP code to an HTML site?


#1

Hi,

I wonder does anybody can help me on how to add PHP code to an HTML site, since I can’t see any topic on this in the forum.

My intention is to add this code:
< !–#include virtual="/rssfeeds.php" – >

to my page at http://www.howtobuycar.com/buynewcar/index.html with rssfeeds.php files in the same folder http://www.howtobuycar.com/buynewcar/

But it didn’t work. It seems that I have to add some instructions in your website’s .htaccess file. So what I must do in order to work? Please explain me in step by step detail, since I’m not geek enough:)

Do I need to use a program like putty.exe? If yes, how to do it?

Regards
Kusuma Widjaja


#2

All you you would need to is insert this into the HTML page.

<?php include (filename.ext) ?> Then make sure that you save your page as a .php page. Without this extension, the php code will not be rendered, and the file will not be included.

================================
I’d give my right arm to be ambidexterous!


#3

I’m guessing that’s his problem? Rather than editing lots of html files to now read php, he wants to just include a few php things?

Try reading this http://www.webmasterworld.com/forum10/5296.htm


#4

The code you posted will look for rssfeeds.php in the root directory of your site. If the file is actually in /buynewcar, change the path:

<!--#include virtual="/buynewcar/rssfeeds.php"--> You also seem to be using a .html file extension. SSI, by default, uses the extension .shtml. If you want SSI to work on .html pages, you need to add the following to /.htaccess:

AddHandler server-parsed .html (this assumes you aren’t already using SSI elsewhere and haven’t already done this)


If you want useful replies, ask smart questions.