singapore: the smallest big galery
home » forum » Mods » File Date Sort Fix

You are not logged in.

#1 2009-05-13 05:28:55

DC
Administrator

File Date Sort Fix

Ok we got a lot of requests for a fix on the not so perfect date and file sort functions in SGAL ...

while up late one nite in the lab we came up with a great little fix for the sort problem that has urked our users for a while now, all you have to do is open up the singapore.class.php file in your txt editor look for the function multiSort and replace it with the following function. after that you will see your images will be sorted correctly.

Code:

function multiSort($a, $b) {
  //File date sort fix by DC ...
  switch($GLOBALS["sgSortOrder"]) {
      case "f" : return strnatcasecmp($a->id, $b->id); //case-insensitive file
      case "F" : return strnatcasecmp($b->id, $a->id); //case-insensitive file (reverse)
      case "p" : return strcmp($a->id, $b->id); //path
      case "P" : return strcmp($b->id, $a->id); //path (reverse)
      case "n" : return strcmp($a->name, $b->name); //name
      case "N" : return strcmp($b->name, $a->name); //name (reverse)
      case "i" : return strcasecmp($a->name, $b->name); //case-insensitive name
      case "I" : return strcasecmp($b->name, $a->name); //case-insensitive name (reverse)
      case "a" : return strcmp($a->artist, $b->artist); //artist
      case "A" : return strcmp($b->artist, $a->artist); //artist (reverse)
      case "d" : return strnatcasecmp($a->date, $b->date); //date
      case "D" : return strnatcasecmp($b->date, $a->date); //date (reverse)
      case "l" : return strcmp($a->location, $b->location); //location
      case "L" : return strcmp($b->location, $a->location); //location (reverse)
   }
}

What was broken is now fixed by popular demand.

DC


To code or not to code that is the question?

Did my response help you out? Consider donating by buying me a slice, Whats this? Read More!
http://www.clickcraft.net/slice.php

Offline