Change order of categories?

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
baden32
Regular
Posts: 18
Joined: Mon Feb 12, 2007 3:48 pm

Change order of categories?

Post by baden32 »

I just started to use serendipity and defined some categories to post articles.
Everything is ok but now I need to modify the order the categories are displayed on my website.
How can I do that? In the category admin, I can only see how to define/remove categoriy.
Thank you in advance for your help.
Joel
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Change order of categories?

Post by garvinhicking »

Hi!

In the configuration of the categories plugin you can specifiy if categories should be sorted alphabeticaly, by their creation date or by their ID.

Sadly currently you cannot manually sort categories.

The other option is to build a manual category HTML nugget listing instead of an automatted one.

Best Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
baden32
Regular
Posts: 18
Joined: Mon Feb 12, 2007 3:48 pm

Post by baden32 »

Hi!
Thank you for your replay. I did not see in the plugin config we can change thw way the sort is done. Defining ID as sort order and get access to the database using phpmyadmin wil be ok.
Thanks, Joël.
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

From the Admin Screen, go to "Configure Plugins". Click "Categories" from the list of sidebar plugins. Choose the appropriate key and direction from the "Sort order" dropdowns.

If any part of this is missing, there's a problem. What version of Serendipity are using?
Judebert
---
Website | Wishlist | PayPal
magskcom
Regular
Posts: 5
Joined: Mon Feb 19, 2007 1:26 am

Re: Change order of categories?

Post by magskcom »

garvinhicking wrote:Hi!

In the configuration of the categories plugin you can specifiy if categories should be sorted alphabeticaly, by their creation date or by their ID.

Sadly currently you cannot manually sort categories.

The other option is to build a manual category HTML nugget listing instead of an automatted one.

Best Regards,
Garvin
manual catergory HTML nugget listing, what is this?

Because I am having the same problem I need to change the order the entries on my blogs frontpage are displayed and I cant figure it out.

Thanks
Mike
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Change order of categories?

Post by garvinhicking »

Hi!
manual catergory HTML nugget listing, what is this?
Basically, that just:

1. Viewing the HTML output of your current category sidebar plugin

2. Copy that HTML code to an edito, shuffle it the way you need

3. Put the resulting HTML into a "HTML Nugget" sidebar plugin.

Beware that you need to change your HTML code everytime you add or remove a category, because with this method you effectively bypass the automatic functions.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
hokiepontas
Posts: 2
Joined: Mon Feb 19, 2007 6:55 pm

Post by hokiepontas »

If you're hip with databases, you could simply change the ID of your categories so it matches what you want. But, keep in mind, you'd need to start at a different number than "1".

For instance, if you've got 5 categories and you want them ordered "d e b a c", what I would do is change the category ID numbers:
a: 1 => 14
b: 2 => 13
c: 3 => 15
d: 4 => 11
e: 5 => 12

And then, if you really care about the ID#s going from 1-n, execute the sql statement: update s9y_category set categoryid=categoryid-10;

(where s9y_ is the table prefix in your database, and 10 is the number you wanna subtract off of all of 'em)

Granted, then you have to go into the database every time you want to rearrange something, but personally: I find it preferable to do that than to rearrange HTML because I think the chances of making a mistake (accidentally deleting some characters, that kind of thing) are much smaller with the database.
Nihilists
Regular
Posts: 19
Joined: Fri Aug 24, 2007 9:58 pm

Post by Nihilists »

Here is my idea to change the order of the categories without always having to edit code in the templates.

In the plugin_categories.tpl remove the code:
title="{$plugin_category.category_description|escape}"
from the line that creates the category title and link

Change the sorting method to description for the categories.

Edit the categories descrtion to something like
a,b,c,d,e...

Double letter may help with subcategories. The only things that appear to lost is the rollover function on the links
Post Reply