You are here: Re: How to change pictures everyday using php « All PHP « IT news, forums, messages
Re: How to change pictures everyday using php

Posted by Tony on 09/28/49 11:17

"Joseph Melnick" <jmelnick@jphp.com> wrote in message
news:GYSdnSQYc4sl5QbfRVn-uA@rogers.com...
> Hello Luigi,
>
> What you could try: without using a database.
> 1. create a file with all of the picture names. named: pictures.txt
> name1.jpg
> name2.jpg
> name3.jpg

You could also read the filenames from the directory to populate the
filename array - although that would force everything into alphabetical
order..

>
> 2. use date() to give you the day of the year
>
> $todayspicture = 'defaultpic.jpg';
> $dayofyear = date("z"); // day of year 0-365
> // today is day 149 so to start from zero subtract from 149 from $dayof
> year
> $lines = file("pictures.txt");
> if(count($lines)<$dayofyear) $todayspicture = $lines[$dayofyear];
>
> Hope this helps
>
> Joseph Melnick
> JM Web Consultants
> http://www.jphp.com
>
>
>

 

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

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