Created
August 24, 2010 21:32
-
-
Save thiagosf/548367 to your computer and use it in GitHub Desktop.
Helper para Lightbox
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 | |
/** | |
* Helper para Lightbox | |
*/ | |
class LightboxHelper extends AppHelper { | |
var $helpers = array('Html'); | |
function img($thumb, $full, $imgAttributes = array(), $linkAttributes = array()) { | |
$defaultLinkAttributes = array('rel'=>'lightbox'); | |
$linkAttributes = array_merge($defaultLinkAttributes, $linkAttributes); | |
$thumb = $this->Html->image($thumb, $imgAttributes); | |
if (strpos($full, '://') === false) { | |
$full .= '?r='.rand(0,77777); | |
$full = $this->Html->webroot(IMAGES_URL . $full); | |
} | |
return $this->Html->output(sprintf( | |
$this->Html->tags['link'], $full, $this->Html->_parseAttributes($linkAttributes), $thumb) | |
); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment