coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: graemerae on May 30, 2007, 01:42:42 AM

Title: Change display order in editpics.php
Post by: graemerae on May 30, 2007, 01:42:42 AM

How do I change the display order of the files in editpics?  I want them sorted by 'most recent first' - it seems to be sorting them in name order. Am I missing something in a setting somewhere?

TIA!
Title: Re: Change display order in editpics.php
Post by: bowserbabe on May 30, 2007, 03:13:37 AM
I don't believe it's an option anywhere. You can modify editpics.php to change the sort order, though.

Find this:
                $sql = "SELECT p.*,a.category FROM {$CONFIG['TABLE_PICTURES']} as p ".
                           "INNER JOIN {$CONFIG['TABLE_ALBUMS']} as a ".
                           "ON a.aid=p.aid ".
                           "WHERE p.aid = '$album_id' ".
                           "ORDER BY p.filename LIMIT $start, $count";


And replace it with this:
                $sql = "SELECT p.*,a.category FROM {$CONFIG['TABLE_PICTURES']} as p ".
                           "INNER JOIN {$CONFIG['TABLE_ALBUMS']} as a ".
                           "ON a.aid=p.aid ".
                           "WHERE p.aid = '$album_id' ".
                           "ORDER BY p.pid LIMIT $start, $count";



It'll be in oldest to newest order. To get the newest files at the beginning, add DESC after p.pid:
                           "ORDER BY p.pid DESC LIMIT $start, $count";

And yay that's the first question I've gotten a chance to answer. ^^
Title: Re: Change display order in editpics.php
Post by: bowserbabe on May 30, 2007, 03:20:19 AM
Being able to edit would be super. You said you wanted newest first. So

this:
                $sql = "SELECT p.*,a.category FROM {$CONFIG['TABLE_PICTURES']} as p ".
                           "INNER JOIN {$CONFIG['TABLE_ALBUMS']} as a ".
                           "ON a.aid=p.aid ".
                           "WHERE p.aid = '$album_id' ".
                           "ORDER BY p.filename LIMIT $start, $count";

to this:
                $sql = "SELECT p.*,a.category FROM {$CONFIG['TABLE_PICTURES']} as p ".
                           "INNER JOIN {$CONFIG['TABLE_ALBUMS']} as a ".
                           "ON a.aid=p.aid ".
                           "WHERE p.aid = '$album_id' ".
                           "ORDER BY p.pid DESC LIMIT $start, $count";


and nevermind the rest I said. Too long a delay between when I read your post and when I posted my reply. :\
Title: Re: Change display order in editpics.php
Post by: bowserbabe on May 30, 2007, 03:26:20 AM
 :'(

In editpics.php... this:
                $sql = "SELECT p.*,a.category FROM {$CONFIG['TABLE_PICTURES']} as p ".
                           "INNER JOIN {$CONFIG['TABLE_ALBUMS']} as a ".
                           "ON a.aid=p.aid ".
                           "WHERE p.aid = '$album_id' ".
                           "ORDER BY p.filename LIMIT $start, $count";


to this:
                $sql = "SELECT p.*,a.category FROM {$CONFIG['TABLE_PICTURES']} as p ".
                           "INNER JOIN {$CONFIG['TABLE_ALBUMS']} as a ".
                           "ON a.aid=p.aid ".
                           "WHERE p.aid = '$album_id' ".
                           "ORDER BY p.pid DESC LIMIT $start, $count";


No more mistakes, I swear. And I don't know how people do the code boxes and yet still have the php colors. Hence my problematic last post. A thousand apologies to everyone who reads this thread.
Title: Re: Change display order in editpics.php
Post by: Joachim Müller on May 30, 2007, 09:35:00 AM
Quote from: bowserbabe on May 30, 2007, 03:26:20 AM
And I don't know how people do the code boxes and yet still have the php colors.
To accomplish syntax highlighting, SMF's bbcode either needs leading PHP opening tags like this:<?php
  
echo 'Hello World';
?>
or you can use the tag [ p h p ] (without the spaces) as well, which results in                $sql = "SELECT p.*,a.category FROM {$CONFIG['TABLE_PICTURES']} as p ".
                           "INNER JOIN {$CONFIG['TABLE_ALBUMS']} as a ".
                           "ON a.aid=p.aid ".
                           "WHERE p.aid = '$album_id' ".
                           "ORDER BY p.pid DESC LIMIT $start, $count";as you have done in your previous posting. When using the [ c o d e ]-tag, it depends on the leading PHP-tag:<?php
  
echo 'Hello World';
?>
  echo 'Hello World';
Title: Re: Change display order in editpics.php
Post by: graemerae on May 30, 2007, 03:33:34 PM


that got it - thanks all!

Title: Re: Change display order in editpics.php
Post by: bowserbabe on May 31, 2007, 03:55:28 AM
Thanks GauGau, that makes way more sense than what it says in the FAQ.

And I'm glad you understood, graemerae, despite the mess I made of my replies.  ;)