|
Posted by password on 11/10/06 22:14
"J.O. Aho" <user@example.net> wrote in message
news:4rji4gFr5i8uU1@mid.individual.net...
> password wrote:
> > hello, i am using an automatic image rotator (php) which rotates images
on
> > refresh or everytime a page is accessed and i was wondering if it is
> > possible to make the image change on a daily basis instead. ive been
hunting
> > the net but dont seem to be able to find a script that would do this.
> >
> > i am assuming it is possible but my knowledge of php is very limited.
> >
> > any help or pointers would be gratefully received and acknowledged.
>
> There are many ways to make it to pick one image per day and how to do
that
> depends a bit on the original code too (as you may not want to rewrite
> everything). You will find a rand() that determines which image to load
(most
> likely from an array), you replace the rand() with a function that you
make
> that gives different values each day, one could just be the number of the
day
> in the current month, so if you have 31 images thats no problem, but if
you
> have fewer then you would have days without any image at all. Modulus is a
> good way say [<date>%number of images] would give you a number that would
> always give an image for you, even if you have less than there are days in
a
> month, if you have more, then you need to use day-number (first of feb
would
> be 32).
>
> I hope you got the idea and have the will of making a try, do a backup of
the
> current code, so if it gets broken, you can at least get back to the
original
> code.
>
>
cheers, that has given me a starting point for some more investigating.
Navigation:
[Reply to this message]
|