Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-03-27 21:33:30

progre55
Member
Registered: 2006-05-02
Posts: 668

Custom Fields

I need to create a list of articles based on a custom field. I can successfully do this with the following:

<txp:article_custom section="music" sortby="Title" sortdir="asc" form="myForm" limit="99999" Year_Published="2012" />

My questions is, how can I create a list that populates with not only the music published in 2012, but also music published in 2011 and 2010.

I tried this code:

<txp:article_custom section="music" sortby="Title" sortdir="asc" form="myForm" limit="99999" Year_Published="2012,2011,2010" />

but it returned nothing.

Any asisstance would be appreciated.

Progre55

UPDATE for anyone interested:

I found this to work:

<txp:article_custom section="music" sortby="Title" sortdir="asc" form="myForm" limit="99999" Year_Published="_%" />

The above solved my problem so I hope it may help others.

Last edited by progre55 (2012-03-27 21:54:24)

Offline

#2 2012-03-27 23:42:17

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

Re: Custom Fields

progre55 wrote:

sortby=“Title” sortdir=“asc”

If this code is necessary and the newer sort="Title asc" is rejected you should urgently update your site to TXP’s current version for security reasons.

Year_Published="_%" […] The above solved my problem so I hope it may help others.

For “others”: the above fetches anything with any entry in “Year_Published” (source).


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

Offline

#3 2012-03-28 12:20:11

progre55
Member
Registered: 2006-05-02
Posts: 668

Re: Custom Fields

uli:

I am using the most recent version, but for whatever reason had grabed the old code. It is now updated. Thanks.

progre55

Offline

#4 2012-03-28 12:28:18

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

Re: Custom Fields

The old code works flawlessly as long as you don’t switch to debug or testing mode, found that out yesterday. So it’s obviously no problem using old version queries. But it’s a nice indicator for making people aware of potential risks. Good to read you’re using the most recent version, though.


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

Offline

Board footer

Powered by FluxBB