Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » Archives
  3. » Complex sortby

#1 2006-06-27 19:36:38

jamiew
Archived Plugin Author
From: NYC
Registered: 2005-01-08
Posts: 74
Website

Complex sortby

I’ve got a list of articles whose titles are actually people’s names and want to sort by lastname. While I hunt for a real solution I sorted things using a custom field which I punch the first letter or two of the name into, but this is definately not The Right Way.

Has anyone hacked around with complex sorting options? i.e. could I hypothetically install a MySQL stored procedure that emulates split() and use a sortby="SPLIT(' ', 2)" á la sortby="rand()" ?. I poked in the core code but couldn’t decipher the sortby voodoo — how & where is it handled?

Last edited by jamiew (2006-06-27 19:37:26)

Offline

#2 2006-06-27 23:12:00

zem
Developer Emeritus
From: Melbourne, Australia
Registered: 2004-04-08
Posts: 2,579

Re: Complex sortby

Search for ‘sortby’ in publish.php.

You’d be better off rearranging your custom fields for natural sorting: use two separate fields for last and first name, or store “lastname, firstname”.


Alex

Offline

  1. Index
  2. » Archives
  3. » Complex sortby

Board footer

Powered by FluxBB