Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-08-12 18:44:20

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

article custom - title ascending with numbers

if i have a set of articles that say:

article #1
article #2…
article #10
article #11
article #12

if i set the sort value to title ascending, it will go article #1, article #10, article #11
does anyone know how to fix this?

Offline

#2 2009-08-12 19:50:26

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: article custom - title ascending with numbers

sort="Title+0 ASC"

The +0 part forces the Title string into a number, so it sorts numerically instead of alphabetically as a string would.

Offline

#3 2009-08-12 20:29:22

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

Re: article custom - title ascending with numbers

awesome, thanks will try that out soon

Offline

#4 2009-08-13 01:24:32

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

Re: article custom - title ascending with numbers

hmm i just tried it out and it made it so that #6 was the top of the list. strange eh?

Offline

#5 2009-08-14 19:41:30

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

Re: article custom - title ascending with numbers

just to follow up, i still have not resolved this problem. thanks

Offline

#6 2009-08-14 20:27:36

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

Re: article custom - title ascending with numbers

You could rename the articles to:

article #001
article #002
article #010
article #011
article #012

to achieve the result you want.

Offline

#7 2009-08-14 20:39:26

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

Re: article custom - title ascending with numbers

ok in that case i should make a custom field to achieve that because adding the 0 in front will detract from the appearance. thank you

Offline

#8 2009-08-14 22:31:48

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: article custom - title ascending with numbers

What exactly is the value of the title field you’re using… is it #1 or just 1 or something like 1 some text?

Offline

#9 2009-08-14 22:49:59

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

Re: article custom - title ascending with numbers

mrtunes wrote:

adding the 0 in front will detract from the appearance.

Well, they do say beauty is in the eye of the beholder :-).

Offline

#10 2009-08-14 23:34:01

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

Re: article custom - title ascending with numbers

ruud wrote:

What exactly is the value of the title field you’re using… is it #1 or just 1 or something like 1 some text?

the artist didn’t name the photos so we just left them at textures #1, textures #2… and up to textures #16

Offline

#11 2009-08-15 12:38:17

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: article custom - title ascending with numbers

Try this (not tested):

sort="SUBSTRING_INDEX(Title, CHAR(35), -1)+0 ASC"

Offline

Board footer

Powered by FluxBB