Forum Moderators: coopster

Message Too Old, No Replies

Any simple way to display a random page each day?

help me

         

maykel

1:33 am on Sep 25, 2009 (gmt 0)

10+ Year Member



Hi ,
i have a probleme with this
---------------------
<?php
$img = date("z");
echo "<IMG SRC=\"images/".$img.".jpg\">";
?>
--------------------------

" daily pic "

I found this code on this page

[webmasterworld.com...]

is working with the images

Can any one help me to replace the images with pages

andrewsmd

8:57 pm on Sep 25, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You need to explain more. What do you want to do? Right now you are saying that you want to show an image 267. the function date("z"); returns the number of days from the start of the year. So the html of that output would be
<img src="images/267.jpg">. Tomorrow that code would be <img src="images/268.jpg">. The next day it would be <img src="images/269.jpg"> etc. If you want to display a random image then you would need to read all of those images in a directory and display one. You need to elaborate a little more. This script would work well enough if you have 365 images and they are named 0.jpg, 1.jpg, 2.jpg etc. Once again, you need to tell me more though.

optik

10:28 am on Sep 26, 2009 (gmt 0)

10+ Year Member



I think he wants to randomise a whole page not just an image, I would suggest using the random function and page includes.

$random=rand ( $min ,$max )

&

include("page_".$random.".php");