You are here: Re: rotate image daily « All PHP « IT news, forums, messages
Re: rotate image daily

Posted by sTony on 11/11/06 08:10

"password" <fatpipe@epiptaf.com> wrote in message
news:XZidnTrQONQbZMnYnZ2dnUVZ8sOdnZ2d@eclipse.net.uk...
>
> <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.
>
>
Just out of curiosity, why use php for something as simple as image
rotation? Why not just use Javascript, or do you expect that Javascript will
not be available? Just wondering. Either way, just check the date and use
it as a control to select which image to display. Another option would be to
add a cookie which expires in a day, and just store the imagepath in the coo
kie. If the cookie exists, show that image, otherwise, make a new cookie
and store that image. There are lots of options, but really, it's rather
stupid to be scanning words to begin with, since most people seem to have an
attention span of less than four seconds, especially when online, it's
always best for a page to be as fast as possible, and I expect your poet
friend will lose visitors if he continues on insisting to use scanned poems,
rather than just words. People online aren't known for their patients.

Keep Coding,

sTony

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация