List of imagesPrevious article Next article
An example User Defined Tag which reads the images in a folder and shows it in a unordered list. With JQuery, Fancybox and some styling you can use it to create a simple photogalery. The article is only about the User Defined Tag, the required extra functionality is not included!
This article originates from the former CMSMS Wiki, the original author is Elijah Lofgren. I cleaned the code and added code to *not* read thumb images in the folder.
User Defined Tag, named "list_images"
$dir = cmsms()->config['root_path'] . DIRECTORY_SEPARATOR . $url;
if ($dh = opendir($dir))
while (($file = readdir($dh)) !== false)
if ( ('file' == filetype($dir . $file)) && (substr($file,0,6) != 'thumb_') )
echo '<li><a href="'.$url.$file.'" class="fancybox"><img src="'.$url.'thumb_'.$file.'" alt="'.$file.'" /></a>'."</li>\n";
How to use
Add in your page:
Change the url in the tag to your own!
No comments yet...