I realise this is a complete newbie question...but I am stumped!
I have included a PHP script (via the html tool in VSD) :
<?php
function wordofday()
{
$filename = "phptest/words.txt";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);
$array = explode("\n",$contents);
$date = date("z");
if($date > count($array))
{return $array[0]; }
else
{return $array[$date]; }
}
echo '<p> </p><p>'.wordofday().'</p>';
?>
The problem is that all it returns is the following :
count($array)) {return $array[0]; } else {return $array[$date]; } } echo '
'.wordofday().'
'; ?>
i.e. everthing after the "greater than symbol"
I realise that in html this is a tag...but surely not within the php script?
I would appreciate any help....what is it I need to do, or what is it I am doign wrong?
Thanks!
Your script works. Just make sure you file is named with a .php extenstion
index.html = wrong
index.php = correct
Easy Web Hosting
http://www.easywebhosting.com
Hi Thanks for that...I have looked at that option....but it means a lot of work changing all my links etc....and I will need to do this outside VSD (in an HTML editor).
I was under the impression that I could just run php within VSD.
I guess if I was uploading to say a Linux server...I would only need to add\ammend the ".htaccess" file and leave the page extensions alone?
Thanks
Adrian
not sure it hosting providers will allow you to execute html files as php
Easy Web Hosting
http://www.easywebhosting.com