This script can be used to sort the content of a table based on the month
<?php
$seasonContent = array(1 =>'<div class="month" id="january"> January Content </div>','<div class="month" id="febuary"> Febuary Content </div>','<div class="month" id="march"> March Content </div>','<div class="month" id="april"> Apirl Content </div>','<div class="month" id="may"> May Content </div>',' <div class="month" id="june"> June Content </div>','<div class="month" id="july"> July Content </div>', '<div class="month" id="august"> August Content </div>',' <div class="month" id="september"> September Content </div>','<div class="month" id="october"> October Content </div>','<div class="month" id="november"> November Content </div>','<div class="month" id="december"> December Content </div>');
$month = date('n');
echo $seasonContent[$month];
$month = $month 1;
while ($month <= 12) {
echo $seasonContent[$month];
$month ;
}
$month = 1;
while ($month < date('n')) {
echo $seasonContent[$month];
$month ;
}
?>
<?php
$seasonContent = array(1 =>'<div class="month" id="january"> January Content </div>','<div class="month" id="febuary"> Febuary Content </div>','<div class="month" id="march"> March Content </div>','<div class="month" id="april"> Apirl Content </div>','<div class="month" id="may"> May Content </div>',' <div class="month" id="june"> June Content </div>','<div class="month" id="july"> July Content </div>', '<div class="month" id="august"> August Content </div>',' <div class="month" id="september"> September Content </div>','<div class="month" id="october"> October Content </div>','<div class="month" id="november"> November Content </div>','<div class="month" id="december"> December Content </div>');
$month = date('n');
echo $seasonContent[$month];
$month = $month 1;
while ($month <= 12) {
echo $seasonContent[$month];
$month ;
}
$month = 1;
while ($month < date('n')) {
echo $seasonContent[$month];
$month ;
}
?>
0 comments:
Post a Comment