Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

  1. Index
  2. » Archives
  3. » Sort by number

#1 2006-04-05 02:36:47

smallt
Member
Registered: 2004-12-21
Posts: 26

Sort by number

Greetings – I am trying to create a specified order of posts, something like #1 – #26, and have them render according to that order. So, I have numbered each of the posts using a custom field and used sortby=“custom_1” to no avail. It seems that the code parsing the sort order processes numbers with more than one digit as an array. Therefore instead of the order rendering like 1, 2, 3, etc. it is rendering 1, 10, 11, 12, 13, … 2, 21, 22, 23 etc. Is there any other way to specify a precise order of posts using numbers and custom fields? – Thanks in advance.

Offline

#2 2006-04-05 03:50:06

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

Re: Sort by number

It depends upon what you’re needing it for, since the technique needed could greatly vary. Can you briefly describe the purpose? Are these all articles in the same section? If so, are there any other articles in the section? If there are, are these considered “special” when compared to the others?

Offline

#3 2006-04-05 04:03:05

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

Re: Sort by number

The simplest solution would be to use leading zeroes to pad all numbers to the same number of digits: 01, 02, 03.. 10, 11, 12 etc.


Alex

Offline

#4 2006-04-05 13:34:44

smallt
Member
Registered: 2004-12-21
Posts: 26

Re: Sort by number

Alex – thank you sir. I thought of that just after posting my question. Works like a charm.

Offline

  1. Index
  2. » Archives
  3. » Sort by number

Board footer

Powered by FluxBB