4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: kindian on April 12, 2006, 12:51:13 AM

Title: Category Dropdown Ordering
Post by: kindian on April 12, 2006, 12:51:13 AM
Can someone tell me how to order the category dropdown from A to Z instead of category ID ordering?

And how do show only MAIN CATS there?

thanks in advance.
Title: Re: Category Dropdown Ordering
Post by: V@no on April 12, 2006, 01:44:17 AM
To show only main cats, replace in includes/functions.php
Code: [Select]
  $drop_down_cat_cache = $cat_parent_cache;
with:
Code: [Select]
  $drop_down_cat_cache[0] = $cat_parent_cache[0];

And to sort them by name, below that line, insert:
Code: [Select]
  uasort($drop_down_cat_cache[0], "catsortname");
then, at the very end of the file, ABOVE closing ?> insert:
Code: [Select]
function catsortname($a, $b)
{
  global $cat_cache;
  return strcasecmp($cat_cache[$a]['cat_name'], $cat_cache[$b]['cat_name']);
}
Title: Re: Category Dropdown Ordering
Post by: kindian on April 12, 2006, 01:46:21 AM
thanks alot v@no, i'll try that out :)
Title: Re: Category Dropdown Ordering
Post by: kindian on April 12, 2006, 02:40:34 AM
V@no, only main cats appear like I wanted, but the sort is not good. Categories are all mixed, no alphabetical order after instering your code. what's wrong?
Title: Re: Category Dropdown Ordering
Post by: V@no on April 12, 2006, 06:41:59 AM
try now
Title: Re: Category Dropdown Ordering
Post by: kindian on April 12, 2006, 12:47:57 PM
V@NO PERFECT!!!!  8)

Thanks again!
Title: Re: Category Dropdown Ordering
Post by: kindian on May 30, 2006, 08:16:08 PM
V@no do you think you can help me now again:

The categories show exactly as a I wanted in normal pages, but when I try to edit a photo and move it to a subdir, the subdirs dont show up, just the main catgs.

what do I have to change in order to the admin edit image area show the drop down with all the subcats?
Title: Re: Category Dropdown Ordering
Post by: V@no on May 31, 2006, 12:16:11 AM
You can try replce the two new lines from above with this:
Code: [Select]
  if (defined("IN_CP"))
  {
    $drop_down_cat_cache = $cat_parent_cache;
  }
  else
  {
    $drop_down_cat_cache[0] = $cat_parent_cache[0];
    uasort($drop_down_cat_cache[0], "catsortname");
  }

This will show normal dropdown in ACP.
Title: Re: Category Dropdown Ordering
Post by: kindian on May 31, 2006, 02:47:00 AM
thanks for the help, but it isnt working, the only change I see is the ordering, it only changes the ordering. it doesnt show the sub categories in the CP.
Title: Re: Category Dropdown Ordering
Post by: V@no on May 31, 2006, 06:13:02 AM
Hmmm...what's wrong with me? :S try now, I've update the post above...
Now it should only "sort" dropdown on the "main" site, and should not affect ACP.
Title: Re: Category Dropdown Ordering
Post by: kindian on May 31, 2006, 06:57:26 PM
damn you V@no!!!! that worked like a charm!!!  :D

you're the master, thanks again for yout help!!!!!!!