View Single Post
Old 01-15-2005, 05:37 PM  
donnie
Confirmed User
 
Join Date: Jan 2003
Posts: 1,630
How to call PHP script from a page??

I have this gallery rotator script but I don't know how to call it from my page.
What should I write on my page to get link to a random gallery??
Here is the script:

random.php
-----------------------------------------------
<?
$delim = "\n";
$cryfile = "galleries.txt";
$fp = fopen($cryfile, "r");
$contents = fread($fp, filesize($cryfile));
$cry_arr = explode($delim,$contents);
fclose($fp);
srand((double)microtime()*1000000);
$cry_index = (rand(1, sizeof($cry_arr)) - 1);
$herecry = $cry_arr[$cry_index];
echo $herecry;
?>
-----------------------------------------------

galleries.txt
-----------------------------------------------
<a href="gallery1.url">Gallery 1 Description</a>
<a href="gallery2.url">Gallery 2 Description</a>
<a href="gallery3.url">Gallery 3 Description</a>
etc...
-----------------------------------------------
donnie is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote