I migrate my old app. On old server (php 5.2) I'm using nested alternative if statement to mix html and php code in view, like this:
<?php if($pg_id==1): ?>
<li <?php if ($nav2=='news'): echo 'class="active"'; endif; ?>><a href="<?php echo base_url();?>cms/news/add">News</a></li>
<? endif; ?>
Why on the new server (php 5.5) the above example doesn't works? I'm getting error:
Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\testapp\system\libraries\Loader.php(673) : eval()'d code on line 372
If I want this statement works, I need to rewrite it like this:
<?php if($pg_id==1):
echo '<li';
if ($nav2=='news')
echo 'class="active"';
echo '><a href="' . base_url() .'cms/news/add">News</a></li>';
endif; ?>
The app is written using Codeigniter 1.7.2.