homepage Welcome to WebmasterWorld Guest from 54.226.180.223
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
different picture each of the week or year.
how to display different image on each day of the week
erkhansu




msg:4479899
 2:12 pm on Jul 29, 2012 (gmt 0)

Hi

I need a code that works to show a different pic for each day of week or year. It will be inserted to html. I found some codes but they did not work at all. Can someone let me know how to do it?

image folder: /mooncalendar and image names will be Monday.gif, Tuesday.gif or for year 1.gif, 2.gif, 3.gif etc...

Thanks in advance for your help.

Regards

 

Nutter




msg:4479954
 10:16 pm on Jul 29, 2012 (gmt 0)

Do they have to be named anything specific? Can you name them 0.gif, 1.gif, etc up to 365.gif?

<img src="/path/to/files/<?php echo date('z'); ?>.gif">

date('z') would give you the day of the year from 0-365. Day 365 would only happen in a leap year.

MaxPowers




msg:4480684
 8:22 pm on Jul 31, 2012 (gmt 0)

date('l') would give you days of the week with the filenames being:
Sunday.gif
Monday.gif
etc...

That's a lowercase L in the date code.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved