Reputation: 512
Trying to get this piece of code to run:
<li><a <? if ($tab=='Home') echo 'class="activetab"' ?> href="/">Home</a></li>
Right now, my PHP/Apache on EC2 setup spits out
href="/">Home
It looks like the php inside the tag is messing up the rendering, and I'd like the tab to be rendered.
The site is hosted somewhere else and works, so it seems like a configuration issue with either php or apache.
Upvotes: 0
Views: 82
Reputation: 127
Check your php short tag is open or not?
In your php.ini
change the short_open_tag = Off to short_open_tag = On
.
Upvotes: 3
Reputation: 21
<? ... ?> – This is called as PHP short tags which will work based on the value set with short_open_tag directive of PHP configuration file.
Otherwise use <?php ... ?> as delimiters which are also preferable, since, PHP code enclosed with in <?php ... ?> could be recognized with other PHP servers independent of the tag related configuration directives.
Upvotes: 1
Reputation: 2738
Try By This Code
<li><a <?php if ($tab=='Home') echo 'class="activetab"' ?> href="/">Home</a></li>
Upvotes: 0