Forum Moderators: coopster
Newbie PHP question this one - I'm using PHP includes in my HTML pages fine with this code:
<?php include("http://www.mysite.com/includes/footer.php");?>
However, in footer.php I can only use HTML - straight HTML works fine but if I include any PHP tags such as "<?php" or "<?" I get a "parse error".
The way my server is configured I can use includes from files ending in htm/html, I just add the include code and it works great - maybe this is relevant.
What I'm trying to do is have the include content rotatable. Each page accesses a footer include which in turn uses PHP to select 1 of several different HTML links. Here's what I'm using in my include:
-- Working HTML content here --
<?php
$url1="http://www.site1.com/">text1"
$url2="http://www.site1.com/">text2"
$url3="http://www.site1.com/">text3"
$charset="0321";
$random=$charset[rand(0,2)+1]
$urlname="url".$random
print "<a href="$urlname">";
?>
-- More Working HTML content here --
Also being such a newb I'm not sure if all the quotation marks in my code are correct (never mind the code itself :) ).
Any help much appreciated,
Thanks,
Jeremy
Thanks for the response, I've never had problems before with absolute URLs and I tried your relative URL idea but no luck. Thanks anyway,
Ah hah, just tried using the simplest possible PHP code - one print statement. It worked, so it must be code that's wrong. I'll figure it out from here I guess. Thx again,
all the best,
Jeremy