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 16-04-2009 10:52:12

a_bach
developer/module guru
From: Poland
Registered: 24-11-2008
Posts: 439
Website

albums listing order

Hello

I have small problem with orfer of album list.

http://foto-dalux.com/4.okladki.php

At the bottom of page you can see list of active albums

changed in albums_include.php:

//Loop through dirs
while ($dir = readdir($dir_handle)) {
	if(file_exists('data/settings/modules/albums/'.$dir.'/thumb/image1.jpg')) {

?>

<div class="album">
				<span class="album-info">
					<a href="albums,<?php echo $dir; ?>,<?php echo $current_page_filename; ?>" title="album <?php echo $dir; ?>"><?php echo $dir; ?></a>
				</span>
</div>
<?php
	}
}

And this list on page have wrong order. How to fix it ?

Offline

#2 25-04-2009 17:10:29

Spirit55555
developer
From: Denmark
Registered: 09-11-2008
Posts: 227
Website

Re: albums listing order

You will have to read the albums with read_dir_contents, use natsort on the dirs, and loop thought and display them with foreach.

Offline

#3 26-05-2009 09:25:20

a_bach
developer/module guru
From: Poland
Registered: 24-11-2008
Posts: 439
Website

Re: albums listing order

Spirit55555 wrote:

You will have to read the albums with read_dir_contents, use natsort on the dirs, and loop thought and display them with foreach.

I made it... but little in diffrent way.

file pages_site/albums_include.php

 <?php
/* 
 * This file is part of pluck, the easy content management system
 * Copyright (c) somp (www.somp.nl)
 * http://www.pluck-cms.org

 * Pluck is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 
 * See docs/COPYING for the complete license.
*/

//Make sure the file isn't accessed directly
if((!ereg('index.php', $_SERVER['SCRIPT_FILENAME'])) && (!ereg('admin.php', $_SERVER['SCRIPT_FILENAME'])) && (!ereg('install.php', $_SERVER['SCRIPT_FILENAME'])) && (!ereg('login.php', $_SERVER['SCRIPT_FILENAME']))){
    //Give out an "access denied" error
    echo 'access denied';
    //Block all other code
    exit();
}



//Loop through dirs
$temp = scandir('data/settings/modules/albums');
	natsort($temp);
	foreach ($temp as $tempes) {
		if(file_exists('data/settings/modules/albums/'.$tempes.'/thumb/image1.jpg')) {

?>

<div class="album">
				<span class="album-info">
					<a href="albums,<?php echo $tempes; ?>,<?php echo $current_page_filename; ?>" title="album <?php echo $tempes; ?>"><?php echo $tempes; ?></a>
				</span>
</div>
<?php
	}
}
?>

And site http://foto-dalux.com/4.okladki.php is working good.

This work with pluck 4.6.2

A_Bach

Offline

Board footer

Powered by FluxBB