Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
4.0.2: txp:article sortby="category"
It would be quite useful to be able to sort articles (using txp:article
and txp:article_custom
) by their categories.
A “simple” txp:article sortby="cat1"
and txp:article sortby="cat2"
, similar to sortby=“section”, would do the trick I think. More we be nice too, but I try to keep this feature request as simple as possible :)
With the exemple given on the Faq by Zem, it would allow webmaster to do quite nice things.
Offline
#2 2005-11-02 16:09:56
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: 4.0.2: txp:article sortby="category"
You already can. <txp:article sortby="Category1" sortdir="ASC" />
. I’ll update the wiki.
Offline
Re: 4.0.2: txp:article sortby="category"
I’ll need a new brain, one who is able to understand PHP, not just read it. Anyone seen that on ebay recently ?
Thanks Mary.
One small question before you close the thread (or if you want to move it to How to it’s even better): how to sort on a second level ? Aka, sortby category1, but inside one category how to sort by title (for example) ?
Last edited by Jeremie (2005-11-02 17:06:04)
Offline
#4 2005-11-02 18:08:04
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: 4.0.2: txp:article sortby="category"
For that you’d need to drop sortdir
(I don’t know why its there anyway, it doesn’t need to be), and do:
<txp:article sortby="Category1 ASC, Title ASC" />
That’s assuming that sortdir
doesn’t get changed to be hard-coded in the future.
Offline
Re: 4.0.2: txp:article sortby="category"
Even greater yup. Thanks.
Offline
Re: 4.0.2: txp:article sortby="category"
Ok I found why sortdir is necessary: it’s for txp:article_custom
<txp:article_custom form="articleMultiplesParCat" limit="9999" section="article" sortby="Category1,Title" sortdir="asc" />
does work, but <txp:article_custom form="articleMultiplesParCat" limit="9999" section="article" sortby="Category1 ASC,Title ASC" />
doesn’t (nothing is output for that command).
Offline
#7 2005-11-02 19:32:20
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: 4.0.2: txp:article sortby="category"
Edit: Yeah, its certainly hackish, but it can work.
Last edited by Mary (2005-11-02 19:33:56)
Offline
Re: 4.0.2: txp:article sortby="category"
Well for me the one I quoted work (multiply sortby without asc, and sortdir…) with article_custom… the sortdir is applied to both the sortby, in the correct order. You can see it here (but in french).
Offline
Pages: 1