You are not logged in.
Pages: 1
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&page=viewalbum&album=<?php echo $dir; ?>&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
Pages: 1