Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2019-08-06 11:01:21

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 253
Website

Order of txp:category_list not as expected…

After I upgraded to txp 4.7.3, the order of the categories of txp:category_list is no longer as expected…

This is the tag:

<txp:category_list categories="january,february,march,april,may,june,july,august,september,october,november,december" break="br">

I expect the output to be in the order as specified (January, February, March, etc).

BUT, this is the output:

April
August
December
February
January
July
June
March
May
November
October
September

The documentation says: Comma-separated list of categories to include, displayed in the order specified (unless overridden by sort attribute).

Am I missing something?


JapaneseStreets.com – Japanese street fashion (mostly txp)
Old Photos of Japan – Japan between 1860 and 1940 (100% txp)
MeijiShowa – Stock photos of Japan between 1860 and 1940 (100% txp)

Offline

#2 2019-08-06 13:51:53

michaelkpate
Moderator
From: Avon Park, FL
Registered: 2004-02-24
Posts: 1,196
Website

Re: Order of txp:category_list not as expected…

Did you try, perchance:

<txp:category_list categories="january,february,march,april,may,june,july,august,september,october,november,december" break="br" sort="" />

Offline

#3 2019-08-06 14:23:23

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,207

Re: Order of txp:category_list not as expected…

Kjeld wrote #318967:

This is the tag:

<txp:category_list categories="january,february,march,april,may,june,july,august,september,october,november,december" break="br">

Is that just the opening tag of a container or the whole tag? If the latter, there lacks the final slash. The tag parser became stricter in interpreting code, so maybe that lacking slash confuses it.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#4 2019-08-08 04:25:02

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 253
Website

Re: Order of txp:category_list not as expected…

uli wrote #318972:

Is that just the opening tag of a container or the whole tag? If the latter, there lacks the final slash. The tag parser became stricter in interpreting code, so maybe that lacking slash confuses it.

It is part of a container, actually.

So, I understand from the two reactions that the tag itself is still fine. I’ll check the complete code still more carefully then to see if there is something that confuses the tag.

Thank you to you both!

Last edited by Kjeld (2019-08-08 04:26:46)


JapaneseStreets.com – Japanese street fashion (mostly txp)
Old Photos of Japan – Japan between 1860 and 1940 (100% txp)
MeijiShowa – Stock photos of Japan between 1860 and 1940 (100% txp)

Offline

#5 2019-08-08 09:48:56

milosevic
Member
From: Madrid, Spain
Registered: 2005-09-19
Posts: 388

Re: Order of txp:category_list not as expected…

Name categories as:
01_january
02_february…
And entitle it as:
January
February…

Alphabetic order relies on category names, not category titles.


<txp:rocks/>

Offline

#6 2019-08-08 09:59:08

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 253
Website

Re: Order of txp:category_list not as expected…

Intere

milosevic wrote #318994:

Name categories as:
01_january
02_february…
And entitle it as:
January
February…

Alphabetic order relies on category names, not category titles.

Very smart suggestion to add numbers! Thank you very much.

The tag is supposed to work with the category names in a specific order. So I most likely have something in my code that interferes. If I can’t figure out what the interference is, I will definitely try your suggestion!


JapaneseStreets.com – Japanese street fashion (mostly txp)
Old Photos of Japan – Japan between 1860 and 1940 (100% txp)
MeijiShowa – Stock photos of Japan between 1860 and 1940 (100% txp)

Offline

#7 2019-08-08 10:05:49

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,766
Website

Re: Order of txp:category_list not as expected…

Yes, the tag is supposed to work as described in the docs, in the order you specify. Very odd it’s not behaving for you.

Did a quick test on my (admittedly 4.8.0-dev) site and it retains the order I specified if I use the category names the same as you have. Note they’re case sensitive. Presumably your version of MySQL supports FIELD() ordering?

Last edited by Bloke (2019-08-08 10:07:19)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#8 2019-08-08 10:50:49

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 253
Website

Re: Order of txp:category_list not as expected…

Bloke wrote #318996:

Yes, the tag is supposed to work as described in the docs, in the order you specify. Very odd it’s not behaving for you.

Did a quick test on my (admittedly 4.8.0-dev) site and it retains the order I specified if I use the category names the same as you have. Note they’re case sensitive. Presumably your version of MySQL supports FIELD() ordering?

Thank you, Bloke!

Based on the feedback above, I most likely have some interference from other tags within the container. This week-end I should be able to make enough time to sort it all out. If I can’t figure it out, I’ll be back! 😉


JapaneseStreets.com – Japanese street fashion (mostly txp)
Old Photos of Japan – Japan between 1860 and 1940 (100% txp)
MeijiShowa – Stock photos of Japan between 1860 and 1940 (100% txp)

Offline

#9 2019-08-10 15:00:41

etc
Developer
Registered: 2010-11-11
Posts: 3,312
Website

Re: Order of txp:category_list not as expected…

Kjeld wrote #318967:

BUT, this is the output:

April
August
December
February
January
July
June
March
May
November
October
September

Seemingly name ASC, that was default before. I don’t remember whether we have changed it in 4.7.3 or only in dev. Strange case, though.

Offline

#10 2019-08-14 12:19:28

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 253
Website

Re: Order of txp:category_list not as expected…

Unfortunately, I was unable to make the order of the categories in txp:category_list work by listing them in a certain order under categories=.…

After lots of testing, I can’t find anything that might be interfering.

So, I followed milosevic’s suggestion and changed the category names to 01-january, 02-february, etc. and sort by name.

This fixes it. But I don’t like that the tag no longer works as described on my site.


JapaneseStreets.com – Japanese street fashion (mostly txp)
Old Photos of Japan – Japan between 1860 and 1940 (100% txp)
MeijiShowa – Stock photos of Japan between 1860 and 1940 (100% txp)

Offline

Board footer

Powered by FluxBB