Created
October 1, 2014 13:51
-
-
Save ricardofiorani/7eaa70d647e61f25075c to your computer and use it in GitHub Desktop.
Exemplo de condição php em uma linha
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <li> | |
| <a href="<?= $this->url(array('servicos-interna')) ?>#ancora-conteudo" title="Importação e Exportação" | |
| class="<?= ($this->paginaAtual == 'servicos-interna') ? 'active' : '' ?>"> | |
| Importação e Exportação | |
| </a> | |
| </li> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Note que o <?= é o mesmo que <?php echo, ou seja, você está dando um echo no retorno da condição, exemplo: | |
| <?= ($this->paginaAtual == 'servicos-interna') ? 'active' : '' ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <li> | |
| <a href="<?= $this->url(array('servicos-interna')) ?>#ancora-conteudo" title="Importação e Exportação" | |
| class="<?php if ($this->paginaAtual == 'servicos-interna') echo 'active' ?>"> | |
| Importação e Exportação | |
| </a> | |
| </li> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment