Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-05-31 06:01:19

dandul
Member
From: Brisbane, Australia
Registered: 2010-01-31
Posts: 33

list of articles sorted by custom_field

Hiya, I’ve tried for a while to sort this out but the logic eludes me.

I have a set of articles about various “topics to teach on”.

I have set up a custom field to note how long each “topic” would take. It’s a checklist going from one to ten weeks. (Set up using glz_custom_fields plug-in).

What i would like is to have a list of each of the options: “one week topic, two week topic, three week topic etc” and when the user clicks on one option (eg “three week topic”) there is generated a display of all the articles that have “three-week topic” listed as an option.

I’m guessing this is possible. Can anyone point me in the right direction?

Thanks


Stop wishing things were different to the way they are. Accept it, deal with it, move on.

Offline

#2 2010-05-31 14:56:50

jsoo
Plugin Author
From: NC, USA
Registered: 2004-11-15
Posts: 1,793
Website

Re: list of articles sorted by custom_field

dandul wrote:

What i would like is to have a list of each of the options: “one week topic, two week topic, three week topic etc” and when the user clicks on one option (eg “three week topic”) there is generated a display of all the articles that have “three-week topic” listed as an option.

You could do it with sections. Section names would match the values you’re using in the custom field.

Another method is to pass the value in the URL, using a query parameter, e.g., http://example.com/?wk=2 for the list of two-week topics. Then use the adi_gps plugin to grab the query parameter and pass it to a Txp variable, which you can then use in your article tag.


Code is topiary

Offline

#3 2010-05-31 23:41:17

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 342
Website

Re: list of articles sorted by custom_field

I think the issue is also about sorting of data in custom fields. My experiments using dates suggests that custom fields are stored as simply text, which means sorting by number or date doesn’t work as expected.

Offline

Board footer

Powered by FluxBB