1
brash
Calling a php file from within my theme.html
  • 2003/10/29 10:13

  • brash

  • Friend of XOOPS

  • Posts: 2206

  • Since: 2003/4/10


Ai All,

Boy my thinking cogs really aren't turning tonight. I'm trying to call a php script which randomly selects images from within my theme.html file so that a random image is loaded each time the site is loaded. I'm positive I've done this before, but just can't remember how. Before I go and do some reading up on it, I thought I'd ask here just incase they knew off the top of their head. I've been trying to use an include function, but to date have been fairly much unsucessful. Any help/suggestions appreciated .

2
brash
Re: Calling a php file from within my theme.html
  • 2003/10/29 12:51

  • brash

  • Friend of XOOPS

  • Posts: 2206

  • Since: 2003/4/10


Ok, I've given up on my idea. I've now tried adapting the code from the index.php file of the RandomBabe module which randomly displays GIF and JPG images. I placed this code in my theme.html file to try and get it to display a random picture;

Quote:

<{php}>
mt_srand((double)microtime()*1000000);
$imgs = dir('path/to/images');
while ($file = $imgs->read()) {
if (eregi("gif", $file) || eregi("jpg", $file)) {
$imglist .= "$file ";
}
}
closedir($imgs->handle);
$imglist = explode(" ", $imglist);
$a = sizeof($imglist)-2;
$random = mt_rand(0, $a);
$image = $imglist[$random];
$asin = explode(".", $image);
<{/php}>


It doesn't work so I've obviously overlooked something as my PHP skills are fairly basic. Can anyone point out to me where I'm going wrong, or better yet if there is another/easier way of displaying random image files in my theme.html file?

3
Herko
Re: Calling a php file from within my theme.html
  • 2003/10/29 13:01

  • Herko

  • XOOPS is my life!

  • Posts: 4238

  • Since: 2002/2/4 1


Just a thought: can't you use the banner manager for this, or else the random partner block code??

Herko

Login

Who's Online

243 user(s) are online (110 user(s) are browsing Support Forums)


Members: 0


Guests: 243


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits