I having some trouble with a loop in php. It's with the foreach loop. I have this code:
<?php foreach($obras as $obra): ?>
<li>
<a class="thumb" href="<?php echo $base_url . 'assets/uploads/files/' . $obra["imagen"] ?>" title="<?php echo $obra['titulo'] ?>">
<img src="<?php echo $base_url . 'assets/uploads/files/' . $obra["imagen"] ?>" alt="<?php echo $obra['titulo'] ?>" />
</a>
<div class="caption">
<div class="image-desc">
<p><?= t('global_pieces_artist')?>: <?php echo $obra['nombre_artista'] . ' ' . $obra['apellidos_artista'] ?></p>
<p><?= t('global_pieces_title')?>: <?php echo $obra['titulo'] ?></p>
<p><?= t('global_pieces_year')?>: <?php echo $obra['ano'] ?></p>
<p><?= t('global_pieces_size')?> (cm.): <?php echo $obra['tamano_alto'] ?> x <?php echo $obra['tamano_ancho'] ?><? if ($obra['tamano_largo'] != null): ?> x <?php echo $obra['tamano_largo'] ?><? endif; ?></p>
<p><?= t('global_pieces_technique')?>: <?php echo $obra['tecnica'] ?> </p>
<? if (isset($obra['username'])): ?>
<p><?= t('global_company') ?>: <?php= echo $obra['username'] ?></p>
<? endif; ?>
<p><?= t('global_pieces_price')?>: <?php echo ($obra['precio'] . ' ' . $obra['divisa']) ?> (<?= t('global_pieces_price_vat')?>)</p>
<? if ($obra['observaciones'] != null): ?>
<p><?= t('global_pieces_observations')?>: <?php echo $obra['observaciones'] ?></p>
<? endif; ?>
<p id="links_last">
<a href="<?php echo $base_url . 'assets/uploads/files/' . $obra['imagen']?>"><?= t('global_download')?></a> |
<a href="javascript:window.print();"><?= t('global_print')?></a>
</p>
</div>
</div>
</li>
<?php endforeach; ?>
Well, all things which I want to print are ok, but when I arrive to this part of the code:
<? if (isset($obra['username'])): ?>
<p><?= t('global_company') ?>: <?php= echo $obra['username'] ?></p>
<? endif; ?>
It's when I have the problem because I can see the left side of what I want to see which is the content of <?= t('global_company') ?>
and what it is on the right side I can't see it. If I remove the =
then I have an error, so what I'm doing bad.
Thanks in advance.