|
Posted by itcassy on 10/01/07 17:56
On Oct 1, 1:47 pm, Krustov <m...@privacy.net> wrote:
> <comp.lang.php>
> <itcassy>
> <Mon, 01 Oct 2007 17:19:48 -0000>
> <1191259188.218679.86...@g4g2000hsf.googlegroups.com>
>
> > I would like to pull a random or alphabetical result on the home page
> > of a site and leave that same result on there for one week. The
> > closest example I have found online is Random Quote Version 3.1 which
> > pulls from a text file rather than the database. I cannot mod it to
> > pull from my db and also it relies on cookies, so I would assume it
> > would pull a different random item for each computer and then keep
> > that item on the page for whatever time you specify (?). I am working
> > with dealers and would like to automatically feature a different
> > dealer every week without having to go into the db and choose which
> > one to feature.
>
> <?php
>
> $temp=time()+604800;
>
> # the above is TIME NOW plus one week
>
> # save $temp to database or flat file
>
> ?>
>
> <?php
>
> # grab $temp from database or flat file
>
> $rambo=time();
>
> if ($rambo>$temp) {print "One week has passed - select another dealer";}
>
> ?>
>
> --www.vhit.co.uk
Thanks for the quick response! However, I am not sure this will work.
Maybe I can clarify... I want the page to automatically choose a
different dealer to display automatically every week. Just like a
random sort except not every time you load the page, I only want the
code to choose a new dealer every week. If I save the temp time to
the db, it would only work once (?) for the first week? Please
correct me if I am not following....
Navigation:
[Reply to this message]
|