#1 Instructions for adding PHP code to an HTML site;
PHP scripts do not automatically work on html pages. If you have an HTML or (.HTM) based site, in order for PHP scripts to run on your .htm or .html pages you have a 2 options;
- For Apache Servers Edit your .htacess with AddType application/x-httpd-php .htm .html Then Add the php code from the reader directly to your html pages
- For Apache Servers Edit your .htacess with either .htm server parsed .html server parsed or
Addhandler application/x-httpd-php .html .php Then follow the directions below to use the php code from the reader with SSI Includes.
***NOTE: For Windows or IIS servers - You do not have an .htaccess file. Windows IIS servers also cannot run php on html pages. Your only option for windows IIS servers is to use .shtml or .php pages with the php option from the reader. Or add Javascript to your html pages. For .shtml pages check your setup options and make sure the option for SSI inlcudes is checked, then follow the directions below for creating the SSI include and file.
SSI Includes SSI includes are short commands that reference another file on your server for inclusion on the web page where it is called from. Meaning you can put any information in an external file and remotely call it into any other page on your server with an SSI command. This is especially useful for making the task of editing large websites easier. When the file that is being included is changed, all of the pages that reference that file will change at the same time, without you having to change them all one by one.
SSI is also useful for parsing PHP scripts into .html or .htm webpages, since PHP by itself does not work on html sites. PHP code works on pages that have a .php extension. But instead of changing all of your webpages from .html or .htm to .php extensions, you can use SSI on your html pages.
Follow these instructions below to use SSI Includes with RSS feeds on your .html or .htm website.
1. Open a plain text editor like Notepador Textpad and create a new file, then name it rssfeeds.php (This is an example file name, You can actually name this file anything you'd like)
Add the PHP code that was given to you by the RSS reader in to the blank rssfeeds.php file and save it in your root folder and upload it to your server. There should nothing else in the file except the code that was given to you by the reader.
Here is an Example rssfeeds.php file;

Next add this SSI call to your web pages where ever you want to display RSS headlines.
<!--#include virtual="/rssfeeds.php" -->
In order for a .html or .htm site to parse a PHP script on it's pages, you need to have some instructions in your website's .htaccess file. (For this step you will need access to the .htaccess file on your server.)
You can either manually modify the .htaccess file on your server, or if you have Cpanel, this can very easily be done using the 'Apache Handler' Function. Look for the 'Apache Handler' Icon in Cpanel and click on it.

After you click on the Apache Handlers Icon you will see a screen similar to this one below

In the example above there are no instructions for .htm and .html pages. If your Apache form looks like the above then proceed as directed below. If there are instructions already listed under "User Defined Handlers" for .html and .htm extensions then you do not need to modify anything at all.
Next we need to add the instructions ...
.htm server parsed
.html server parsed
Type .htm server parsed in as directed in the picture below, then click on the "Add" button;
You will be instructed that your definitions were assigned to the extensions specified on the next screen.
Click on Go Back and you will see the definition you just added defined under "User Defined Handlers" as demonstrated in the picture below
Repeat the steps above with the extension .html

Click on "Add"

That is it, you have just modifed your .htaccess file to parse .html pages and .htm pages on the server. Visit your web page to see if your feeds are running. If you want the feeds on each page of your website just add the same SSI include to each page. If you add the SSI inlcude to pages in another directory be sure to correct the path to the rssfeeds.php file on your server.
There is no need to create a new rssfeeds.php file for each page unless you are running a different RSS feed (on a different topic) on each page.
If you cannot use "Apache Handler" or if you do not have Cpanel you can manually modify the .htaccess file by adding these two lines below;
.htm server parsed
.html server parsed
If the above does not work you can try adding this line below, which does the same as the two lines above.
Addhandler application/x-httpd-php .html .php
|