Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Sort Category Title Order

Quote Reply
Sort Category Title Order
Hi:

I have a problem.... I have a series of category titles like "The Flintstones" and "The Jetsons" that I want sorted without the "The", but I want the "The" in the title! So, as I am not using meta, I thought I would put the titles sans "The" there, and tell Links to sort alphabetically by that field insteat of the full title. Then I have full control of thre order of the categories!

So, my question is, where do I reset the field sorted for categories?

Thanks!

Dave
Quote Reply
Re: Sort Category Title Order In reply to
Nope: that did NOT do it. build_sort_order_category sets the order of links, not the order for category names. Where is that set at?

Dave
Quote Reply
Re: Sort Category Title Order In reply to
OK- Duh!

I am an idiot! I hang my head in shame. I was searching all over for a subroutine called build_sort_order_category and could not find it... never thinking you woulod make it so EASY to do! Please have a chuckle at my expense!
Smile
Dave
Quote Reply
Re: Sort Category Title Order In reply to
You'll need to look in nph-build.cgi around line 362:

SELECT Category.*
FROM Category, CategoryHierarchy
WHERE CategoryHierarchy.CategoryID = ? AND
CategoryHierarchy.Depth = 1 AND
CategoryHierarchy.SubCategoryID = Category.ID

and add an ORDER BY Category.Name DESC type statement to the end. If you are using page.cgi, you'll also have to do it there.

Cheers,

Alex

Quote Reply
Re: Sort Category Title Order In reply to
Alex:

Thanks for the hint.... but I seem to be missing something....

I added "ORDER BY Category.Header DESC" to the end of both pages, and added terms to the Header field.... but it does not seem to have an effect... what am i missing??? (It has been a long night already...)

Dave
Quote Reply
Re: Sort Category Title Order In reply to
Hi:

The above mod using "ORDER BY" does not quite work. Alex sent me some code, which I have tested and find does work. What I have done is place the works I really want sorted by in the header field, and then applied this mod:

Try editing HTML_Templates.pm and in sub site_html_print_cat change:

foreach $cat (sort @names) {

to:

#####################BEGIN ALEX MOD##########

foreach $cat (sort {
$subcat->{$a}->{Header} cmp $subcat->{$b}->{Header}
} keys %$subcat) {

###########END ALEX MOD

Worked for me!

Thanks!

Dave