Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-02-20 20:40:29

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Sorting links with Linklist

Having a small issue with a linklist tag. I have this code:

<txp:linklist break="li" category="mylinkcategory" sort="linksort asc" wraptag="ul" class="height200" />

All works fine, except for the fact that I have about 20 links in this link category. In the links tab, I have sorted each link like so: 1, 2, 3, 4 etc.

Theoretically, this should work, but once the links get to 10,11,12 etc., then the 11th link displays under the first link instead of after the 10th.

From 1-10 the links display correctly, its only after the 10th link I have issues. A bug maybe?

Running 4.05, because there are some plugins on this install that I am not sure are ready for 4.06.

Offline

#2 2008-02-20 21:35:17

iblastoff
Plugin Author
From: Toronto
Registered: 2006-06-11
Posts: 1,197
Website

Re: Sorting links with Linklist

not tested but what happens when you try “linksort + 0 asc”

Offline

#3 2008-02-20 21:46:46

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: Sorting links with Linklist

And what about sorting them as: 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11… ?


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#4 2008-02-21 03:34:35

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Sorting links with Linklist

Try:

<txp:linklist break="li" category="mylinkcategory" sort="cast(linksort as signed) asc" wraptag="ul" class="height200" />

Offline

#5 2008-02-23 18:58:26

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Sorting links with Linklist

Thanks everyone. I used Mary’s suggestion, which works fine. Is this a bug Mary?

Offline

#6 2008-02-25 01:10:42

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: Sorting links with Linklist

Nope. The linksort field is a text type field, so it would sort the way text is sorted. What I’ve posted converts the field to a numeric type field, which allows you to sort the way numbers are sorted.

Offline

#7 2008-02-25 07:12:42

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Sorting links with Linklist

Its a nice feature to have sorting by numbers, because that’s the way most people/clients sort their links. Will this become a feature? The Textbook entry is not very specific on the sort option (how to use it).

Offline

Board footer

Powered by FluxBB