Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-09-20 19:34:11

matthewmcinerney
Member
Registered: 2005-12-28
Posts: 25

Create Links to Sort Articles

Is there an easy way to allow users to sort articles by clicking on a link? It seems to be pretty standard on a lot of sites, but I haven’t found a great way to do it with Textpattern.

I just would like users to be able to click links to sort by Date, Title, and Comment Count both asc and desc

Offline

#2 2008-09-20 21:26:14

joebaich
Member
From: DC Metro Area and elsewhere
Registered: 2006-09-24
Posts: 507
Website

Re: Create Links to Sort Articles

Are you planning to present the information you would like to sort in a table? If so, it sounds like a task for jQuery and its Tablesorter plugin. I don’t know that it is necessarily ‘easy’ but it’s well documented and so not too ‘hard’ :-).

Offline

#3 2008-09-20 21:33:09

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

Re: Create Links to Sort Articles

chs_if_urlvar will help you (it will work for date and title, but not sure it will work on comment count because, afaik, articles can’t be sorted by comment count)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#4 2008-09-20 22:33:57

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Create Links to Sort Articles

maniqui wrote:

afaik, articles can’t be sorted by comment count

Can. <txp:article sort="comments_count asc" />. Comments_count is column inside textpattern table and as it is, it can be used as a sorter.

Last edited by Gocom (2008-09-20 22:35:21)

Offline

#5 2008-09-20 22:46:58

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

Re: Create Links to Sort Articles

Thanks for clarifying, Gocom.

My brain was messed because few days ago, I read a post by ruud about articles not “sortable” by last comment posted, but that’s because that info (last comment) is saved in other table.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB