Old 01-02-2007   #1 (permalink)
Registered User
 
Join Date: Dec 2006
Posts: 6

PHP in HTML

Hello

I am trying to insert a PHP element into my HTML web page and so far I have had little success.

I want to add a RSS reader to my site using PHP code and the vendor is suggesting the following

The want me to modify the htaccess. file with one of the following, which I have no problem with but it doesn't seem to work.

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;

1. 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

2. 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.


Now I tried each but the PHP element does not show.

Thanks in advance

Cheers,
__________________
I love deals
booksvista
ultranet is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 01-02-2007   #2 (permalink)
Pimpin' Webmaster
 
dEUS's Avatar
 
Join Date: Nov 2006
Location: Antwerp
Posts: 23

Just use index.php instead of index.htm(l).
Then you won't have to go through all the trouble...
__________________





Last edited by dEUS; 01-02-2007 at 02:27 PM.
dEUS is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 01-02-2007   #3 (permalink)
Rusty Bio-Hazard!
 
notjustgraphics's Avatar
 
Join Date: Sep 2006
Location: Toronto, Ontario, Canada
Posts: 1,067

Send a message via MSN to notjustgraphics
Hey ultranet...

In order to get your server to parse PHP elements in pages with a .htm or .html extension, you need to add these two lines to your .htaccess file in the root directory of your site:

Code:
AddType application/x-httpd-php .php .html
AddType application/x-httpd-php .php .htm
I hope these lines are fairly self explanatory...

Deus is right, simply renaming your index.htm or index.html to index.php will suffice, but sometimes isn't always feasible... especially for existing sites that may have a lot of links to their site, or bookmarks in people's browsers!

There is a remedy for that as well which would be to add this line to your .htaccess file:

Code:
Redirect /index.htm http://yourdomain.url/index.php
Now, some search engines give less rank to dynamic pages (.php) than to static pages (.htm/.html) and so you may wish to consider this when deciding your approach.

I'll assume you know this, but when inserting php into HTML pages, you need to open your php segment with a '<?php' and then close it with a '?>' (exclude quotes).

For example:

HTML Code:
<table>
  <tr>
    <td>Here is my HTML</td>
    <td><?php echo 'Here is my PHP'; ?></td>
  </tr>
</table>
I hope this helps.

If it does not, maybe post a link to your site and I will have a look!

Mike.
__________________
notjustgraphics is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 01-04-2007   #4 (permalink)
Registered User
 
Join Date: Dec 2006
Posts: 6

I am very greatful that I joined to this forum. Thanks a lot for information and the code, I really apriciated it. I couldnt believe it was that simple I will post if I have any other question thanks


Thanks for your support

Dan
__________________
I love deals
booksvista
ultranet is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ajax and PHP sanjitster HTML / PHP / ASP / JS 2 06-03-2006 04:22 AM
Pro's and Con's to Upgrading PHP pipersdragon HTML / PHP / ASP / JS 1 12-29-2005 11:43 PM
PHP Help! Someone please help me LimitLess HTML / PHP / ASP / JS 12 05-16-2004 08:59 AM
Digital's Quick and Dirty Guide to PHP Order HTML / PHP / ASP / JS 15 05-05-2004 01:18 AM


All times are GMT +1. The time now is 08:26 AM.
Content Relevant URLs by vBSEO 3.2.0

Design & Content © BioRUST 2008 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT