|
Posted by password on 11/11/06 18:17
<no@emails.thx> wrote in message
news:934cl2du68p73mq9p0q2cn26rjv4mhdu1u@4ax.com...
> On Sat, 11 Nov 2006 17:52:28 -0000, "password" <fatpipe@epiptaf.com>
> wrote:
>
> >
> ><no@emails.thx> wrote in message
> >news:cq2cl2t29fglrvql5dbc7nm6nipd7tcpsf@4ax.com...
> >> On Fri, 10 Nov 2006 22:13:34 -0000, "password" <fatpipe@epiptaf.com>
> >> wrote:
> >>
> >> >
> >> ><no@emails.thx> wrote in message
> >> >news:cva9l25fib1mgs71g3q72dltte0371fomj@4ax.com...
> >> >> On Fri, 10 Nov 2006 13:55:54 -0000, "password" <fatpipe@epiptaf.com>
> >> >> 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 did a similar thing recently with rotating headers. Instead of
using
> >> >> a date/day we just settled on using the session, so that the header
> >> >> will remain stable for the life of the session - usually the time
the
> >> >> browser is open - but not change when moving between pages.
> >> >>
> >> >> I just:
> >> >> * did session_start() at the top of the pages
> >> >> * set up MAXHEADERS as a define() constant for the maximum number of
> >> >> headers
> >> >> * uploaded 5 different files like header-?.jpg
> >> >> * then called this function to return me the name of the current
> >> >> header file:
> >> >>
> >> >> function header_rotate() {
> >> >> if (!isset($_SESSION['headername'])) {
> >> >> $_SESSION['headername']='header-'.rand(1,MAXHEADERS).'.jpg';
> >> >> }
> >> >> return $_SESSION['headername'];
> >> >> }
> >> >>
> >> >> Chris R.
> >> >
> >> >thanks for that, i know how to do sessions but sadly they, in this
case,
> >are
> >> >of no use because i have a site for a writer/poet who wants to have a
new
> >> >poem for every day and he wants the poem to be a scanned image rather
> >than
> >> >words.
> >> >
> >>
> >> Hmm, I might have misunderstood you somewhere but this function will
> >> let you do that - it returns a file name and you just put it into an
> >> <img> tag - like:
> >>
> >> <img src="<?php echo header_rotate(); ?>" />
> >>
> >oh yeah i know how to do that already - it was a case of getting a new
img
> >to appear on a daily basis rather than on refresh or accessing of a
page...
> >as i said somewhere else i think people are getting confused because of
the
> >terms i have been using due to my ignorance. appologies and many thanks
> >
>
> No problem - if you really have to change the image on a daily basis
> I'd probably just do it by saving a cookie on the client's PC
> containing the date that the image was last updated and then compare
> it against the current system date.
>
> They might not have cookies enabled of course, but in that case you
> can prevent the image changing on every page refresh by using the
> session method as a backup.
>
aye thats why i didnt want to use cookies or javascript to do this.
anyway from a quick look at the script andy posted all i have to do is name
each pic by the date they should appear which is quite good because then we
can tailor special poems/images for particular days such as the qeeens
birthday. hurrah. stands to attention.
[Back to original message]
|