I'm trying to develope an application with codeigniter and I'm trying to find a mistake here which I don't find. The code is the next one:
<?php foreach($projects as $key => $project){ ?>
<li <?php if ($current_project == $project['id']): ?>class="active"<? endif; ?>><a href="<?php echo $base_url . config_item('language_abbr') ?>/<?= $project['id'] ?>/admin/galerias"><?php echo $project['nombre']?></a></li>
<?php } ?>
Before of this I had:
<?php foreach($projects as $key => $project): ?>
<li <?php if ($current_project == $project['id']): ?>class="active"<? endif; ?>><a href="<?php echo $base_url . config_item('language_abbr') ?>/<?= $project['id'] ?>/admin/galerias"><?php echo $project['nombre']?></a></li>
<?php endforeach; ?>
And instead of moaning about the }, it moans about the endforeach; , so what happen?.
And this is the code of the zone where is located the mistake because when I remove this part of code, it works:
<?php if (!empty($user_id) && $isAdmin): ?>
<nav>
<ul class="nav">
<li
<?php if ($current_project == 0): ?>
class="active"
<? endif; ?>>
<a href="<?php echo $base_url . config_item('language_abbr') ?>/0/admin/proyectos"><?= t('h_all'); ?></a>
</li>
<?php
foreach($projects as $key => $project){ ?>
<li
<?php if ($current_project == $project['id']): ?>
class="active"<? endif; ?>>
<a href="<?php echo $base_url . config_item('language_abbr') ?>/<?= $project['id'] ?>/admin/galerias"><?php echo $project['nombre']?></a>
</li>
<?php } ?>
</ul>
</nav>
<?php endif; ?>
Thanks so much
php
but there are some that are used in flow control (if/then/else
) and these do not echo out content yet do not have thephp
either. I realise these may be valid but things like<? endif; ?>>
ought to remain consistent with the other tag styles – RamRaider 2 days ago