Stepinup
 Web Market
          
Home Bookstore Library Emporium     



PHP Monthly Article or Video Rotation Script

Here's a small .php script that will display your content once each month for a few days, depending on the date and number of items to be rotated

Development logic

Day number is 01 (Today's Date is 01)

Set number of items (files -videos or articles) ( 9) -- # days in a month (31) divided by number of items yields number of days per article: 3.4444444444444

Date (01) divided by the number of days per item (3.444) yields raw item# 0.29032258064516

Rounded up item number to display is # 1

Set the $num_items = to the number of videos or articles you want to rotate. Make your file names look like this: video_1.htm, video_2.htm, etc.

CONDENSED SCRIPT:

<?php $num_items = 4; $num_days = 31 / $num_items; $sl = ceil( date("d") / $num_days); include ('video_'.$sl.'.htm'); ?>






Suggestion Box

Please include
your Name and eMail!