Last active
August 29, 2015 14:04
-
-
Save matthojo/08d4426728271e628bc8 to your computer and use it in GitHub Desktop.
Show months in order from current month.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select class="ec-simple-select selectized js-month-select" name="select-month" placeholder="Select an month" tabindex="-1" style="display: none;"> | |
<?php | |
for ($i=5; $i >= 1; $i--) { | |
echo '<option value="'.base_url().'events/bookings/'.((($current_month-$i) <= 0) ? ($current_year-1) : $current_year ).'/'.((($current_month-$i) <= 0) ? (12 + ($current_month-$i)) : ($current_month-$i)).'" >'.date('F', strtotime('01-'.((($current_month-$i) <= 0) ? (12 + ($current_month-$i)) : ($current_month-$i)).'-'.$current_year)).' '.((($current_month-$i) <= 0) ? ($current_year-1) : $current_year ).'</option>'; | |
} | |
?> | |
<option value="<?php echo base_url();?>events/bookings/<?php echo $current_year;?>/<?php echo $current_month;?>" selected="selected"><?php echo date('F', strtotime('01-'.$current_month.'-'.$current_year));?> <?php echo ($this->uri->segment(3)) ? $this->uri->segment(3) : $current_year;?></option> | |
<?php | |
for ($i=1; $i <= 6; $i++) { | |
echo '<option value="'.base_url().'events/bookings/'.((($current_month+$i) >= 13) ? ($current_year+1) : $current_year ).'/'.((($current_month+$i) >= 13) ? (($current_month+$i) - 12) : ($current_month+$i)).'" >'.date('F', strtotime('01-'.((($current_month+$i) >= 13) ? (($current_month+$i) - 12) : ($current_month+$i)).'-'.$current_year)).' '.((($current_month+$i) >= 13) ? ($current_year+1) : $current_year ).'</option>'; | |
} | |
?> | |
</select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment