Return to Snippet

Revision: 27269
at June 1, 2010 04:45 by sapphiriq


Initial Code
<?php

function lightbox($image,$title='',$ext='jpg',$thumbext='jpg') {
	$domain = 'http://example.com/';
	$alt = ' alt=""';
	if( ! $title=='') {
		$alt=' alt="'.$title.'"';
		
		$title = ' title="'.$title.'"';
	}
		echo '<a'.$title.' rel="lightbox" href="'.$domain.'gallery/'.$image.'.'.$ext.'"><img src="'.$domain.'gallery/'.$image.'_thumb.'.$thumbext.'" /></a>';
}

/*

 ---USING---
put images to gallery folder
	1.jpg, 1_thumb.jpg, 2.jpg, 2_thumb.jpg ...
then in php u can do this:

<ul class="images">
	<li><?php lightbox('1'); ?></li>
	<li><?php lightbox('2'); ?></li>
	<li><?php lightbox('3'); ?></li>
	<li><?php lightbox('4'); ?></li>
</ul>

*/

Initial URL

                                

Initial Description

                                

Initial Title
Lightbox helper

Initial Tags
php

Initial Language
PHP