Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Different Image (Banner/Logo) Based on Month
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #1
Different Image (Banner/Logo) Based on Month
A simple way to change an image (banner/logo) based on month.

Image tag in template:

HTML Code
<img src="images_path/image_<?=my_date('n')?>.png" alt="" />

Replace the image_path to an image dir (can be static or dynamic).
For example:

HTML Code
<img src="images/image_<?=my_date('n')?>.png" alt="" />

Upload image_1.png ...... image_12.png to the image dir.


10-17-2011 02:28 AM
Find all posts by this user Quote this message in a reply
Sama34 Offline
Senior Member
****
Posts: 490
Joined: May 2011
Post: #2
RE: Different Image (Banner/Logo) Based on Month
I can design all my holidays banners in a week and that could save me time, thanks RateU.

Is there a way to make it by week/week-day/hour?

Support PM's will be ignored. Yipi
Plugins: Announcement Bars - Custom Reputation - Mark PM As Unread
11-02-2011 06:27 AM
Visit this user's website Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #3
RE: Different Image (Banner/Logo) Based on Month
Well, basically, it uses the PHP Date. So, if we want a different banner for each Sunday (for example), we can use something like this:

Code:
<?=my_date('l')?>

And upload Sunday.png .... Saturday.png images.

The same as hour, for example:

Code:
<?=my_date('G')?>

will give you a value from 0 - 24.


11-02-2011 06:40 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: