Here’s my php code:
<?php if($user->uid == '1'){ ?>
<h3 class="info">Upcoming Games</h3> <!--MY CHANGE -from Athletics Events -->
<?php } ?>
<?php else { ?> <h3 class="info">Athletic Events</h3> <?php }?>
Why do I get this error? I have all the brackets I need, don’t I?
The
}andelse {can’t be broken apart with PHP tags the way that you have it. Think of it as if you were trying to do:This would give you a parse error. Because you are closing the PHP tags, and then effectively outputting whitespace, then reopening, your code is behaving similarly to this. The same also applies if you were to be doing
<?php }?><?php else {?>as well, only it would behave like you were doingecho '';in between.