lundi 15 juillet 2019

Modify button hyperlink based on current month

I have the following code

<td style="text-align: center">
<?php
 if((date('Y-m-d') < $this->Time->format('Y-m-d',$exam['Exam']['date'])) && ($daysOff->workingDayDiff(date('Y-m-d'),$this->Time->format('Y-m-d',$exam['Exam']['date'])) > 4)){
 ?>
<a class="btn btn-default" style="margin-bottom:5px;padding:2px 5px;" href="<?=$linkRegister.$exam['Exam']['id'].DS.$evaluation['Evaluation']['id']?>" title="<?php echo __('Inregistrare', true);?>"><?php echo __('Inregistrare',true);?></a>
<br/>

<?php
}
?>
<a class="btn btn-default" style="margin-bottom:5px;padding:2px 5px;" href="<?=$linkListPart.$exam['Exam']['id']?>" title="<?php echo __('Lista participanti',true);?>"><?php echo __('Lista participanti',true);?></a>
<?php if(!empty($exam['Exam']['results_file_name'])):?>
<a class="btn btn-primary" style="margin-bottom:5px;padding:2px 5px;" href="<?=$view_results_link.$exam['Exam']['id']?>" title="<?php echo __('Afisare rezultate',true);?>"><?php echo __('Afisare rezultate',true);?></a>
<?php endif;?>
</td>

I would like to change the hyperlink of this button

<a class="btn btn-default" style="margin-bottom:5px;padding:2px 5px;" href="<?=$linkRegister.$exam['Exam']['id'].DS.$evaluation['Evaluation']['id']?>" title="<?php echo __('Inregistrare', true);?>"><?php echo __('Inregistrare',true);?></a>

If the current month is July, I want the hyperlink to remain as it is above, but if the month is August, I want to change the hyperlink (it must redirect the user to a different website in August).

<a class="btn btn-default" style="margin-bottom:5px;padding:2px 5px;" href="http://othersite.com" title="<?php echo __('Inregistrare', true);?>"><?php echo __('Inregistrare',true);?></a>

Thanks a lot for the help!

Aucun commentaire:

Enregistrer un commentaire