Created
September 17, 2013 18:31
-
-
Save gilsonbp/6598643 to your computer and use it in GitHub Desktop.
Helper para Zend Framework 1.12.
Retorna uma tag <img> dentro de uma tag <a> de acordo com os parâmetros informados.
This file contains 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
<?php | |
/** | |
* @author Gilson Paulino <gilsonbp@gmail.com> | |
* @version 1 | |
*/ | |
class Zend_View_Helper_Img extends Zend_View_Helper_Abstract { | |
/** | |
* Imprime uma imagem com base nos parâmetros | |
* @param string $src Localização da imagem | |
* @param int $w Largura da Imagem | |
* @param int $h Altura da Imagem | |
* @param string $titulo Título e texto alternativo da imagem | |
* @param string $class Classe CSS da imagem | |
* @param string $link Link de destino da imagem | |
* @param string $destino Quadro de destino da imagem | |
* @return HTML Retorna o código HTML com uma tag <a> e outra <img> | |
*/ | |
public function img($src, $w, $h, $titulo, $class, $link = NULL, $destino = NULL) { | |
if (!is_null($link)) { | |
?> | |
<a href="<? echo $link; ?>" target="<? echo $destino; ?>"> | |
<? } ?> | |
<img src="<? echo $src; ?>" width="<? echo $w; ?>" height="<? echo $h; ?>" class="<? echo $class ?>" title="<? echo $titulo; ?>" alt="<? echo $titulo; ?>"> | |
<? | |
if (!is_null($link)) { | |
?> | |
</a> | |
<? | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment