Gossamer Forum
Home : Products : Links 2.0 : Customization :

Priority field to individually sort links in each category

Quote Reply
Priority field to individually sort links in each category
I was wondering if anyone has put together a hack that will let me assign a number to each link in a category so that when the pages get built, they get built with the links in the order I want them in for each category.

I saw the priority mod, but that seems to only put the links with a Priority = Yes above all the others.

What I want to do is like,
Link 1 - Joe's Site (Priority = 1)
Link 14 - Bob's Site (Priority = 2)
Link 23 - Donna's Site (Priority = 3)

Obviously, I would have multiple 1's (one for each category)

And as links are added there might be accidentally be multiple links in the same category with each number, then it should probably go in order by alpha on the title or something.

TIA for any help.

Jerry
preeper@cts.com
Quote Reply
Re: Priority field to individually sort links in each category In reply to
I think I'm getting closer now. I have added the following line to links.def

PriorityDisplay => [12,'numer',5,8,1,'',''],
and
$db_priority_display = 12;

to be used for the priority code that will allow me to set the order of the links for each category.

Now, I have been messing around with db_utils.pl and it looks like around line 394 there is

return lc($sortby{$a}) cmp lc($sortby{$b});

which appears to be what sorts the links alphabetically by Title.

I have tried replacing this with

return ($sortby{$a}{$db_priority_display}) <=> ($sortby{$b}{$db_priority_display});

but it looks like it only sorts each pair of links, not the whole list.

I have also tried
return ($db_priority_display{$a}) <=> ($db_priority_display{$b});

but that didn't work either.

I'm not really using the whatsnew or whatscool so I believe the sort routines for that get pretty much ignored.

Anyone have any ideas that might help.

Thanks,

Jerry
preeper@cts.com
(not really much of a perl programmer)