Forum Moderators: coopster

Message Too Old, No Replies

Getting a PHP snippet to work in an HTML page

         

brizad

2:36 am on Dec 2, 2005 (gmt 0)

10+ Year Member Top Contributors Of The Month



I would imagine that this has been asked a million times, but unfortunatly, WW is not in the google or yahoo index now (I guess since the site was down so long) and MSN gives cr*p results, and so I couldn't find the answer.

I saw this post but I'm not sure if this is what I need to do or not. Can you tell I don't know beans about PHP? ;-)
[webmasterworld.com...]

Anyhow...I've got this tiny piece of PHP that I'd like to put on several HTML pages so that the page displays this random bit of content.

<?php
$html = file_get_contents("http://www.awebsite.com/cl/index.php?section=serve&id=46&affid=48&output=html");
echo $html;
?>

I read that you can do it with htaccess I think. (the above referenced post mentions that) but it also mentions that it is server intensive. If I put this code on say 20 pages would it make that much of a difference? What if I put it on 5000 pages? Would that be stupid?

If I do this htaccess trick would my page extension still be .html?

Thanks!

bunltd

2:48 am on Dec 2, 2005 (gmt 0)

10+ Year Member



You need to tell Apache to parse html as php... Try this [google.com] for how to use html extensions for PHP pages...

LisaB

wheelie34

9:19 am on Dec 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



yes the .htaccess trick will keep the page as .html I do it all the time

brizad

6:17 pm on Dec 2, 2005 (gmt 0)

10+ Year Member Top Contributors Of The Month



Thanks, I'll give it a shot!