pluck
pluck 4.7 out now, download it today!

pluck support forums

for all your questions about the easiest CMS on the planet

You are not logged in.

Announcement

New registrations are disabled for some spam problems. New registrations will be avaliable soon. If you want to help to keep forum away from spam - contact us.
Please post your bug reports on Launchpad.

#1 29-03-2011 07:35:32

ferarg
Member
From: Valencia, Spain
Registered: 21-08-2008
Posts: 21
Website

Album Module with Real Alphabetical Order

Hi, we change the code of the album module to order alphabetically the albums.

You can download the new code here:

<a href="http://www.box.net/shared/rpztxc3dfp">Code</a>

We change the /data/modules/albums/pages_site/albums_include.php with this code:


[== php ==]
//Open the module-folder
// this code was changed with tip "http://codestips.com/php-read-directory-into-array/"
$directory="data/settings/modules/albums";
   // create a handler to the directory
    $dirhandler = opendir($directory);
 
    // read all the files from directory
    $nofiles=0;
    while ($file = readdir($dirhandler)) {
 
        // if $file isn't this directory or its parent 
        //add to the $files array
        if ($file != '.' && $file != '..'){
			$nofiles++;
			$files[$nofiles]=$file;
        }   
    }
    //close the handler
    closedir($dirhandler);
$files2=sort($files);

//SerInformaticos code 
for ($i=0; $i < count($files); $i++){
	$dir=$files[$i];
?>
<div class="album" style="margin: 15px; padding: 5px;">
	<table>
		<tr>
			<td><img alt="<?php echo $dir; ?>" src="data/modules/albums/pages_admin/albums_getimage.php?image=<?php echo $dir; ?>/thumb/image1.jpg" /></td>
			<td>
				<span style="font-size: 17pt">
					<a href="?module=albums&amp;page=viewalbum&amp;album=<?php echo $dir; ?>&amp;pageback=<?php echo $current_page_filename; ?>"><?php echo $dir; ?></a>
				</span>
			</td>
		</tr>
	</table>
</div>
<?php
}
?>

Last edited by ferarg (29-03-2011 07:43:54)

Offline

Board footer

Powered by FluxBB