Change display order in editpics.php Change display order in editpics.php
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Change display order in editpics.php

Started by graemerae, May 30, 2007, 01:42:42 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

graemerae


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!

bowserbabe

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. ^^

bowserbabe

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. :\

bowserbabe

 :'(

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.

Joachim Müller

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';

graemerae


bowserbabe

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.  ;)