Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-05-05 09:00:58

mlarino
Member
Registered: 2007-06-29
Posts: 367

filtering articles with custom fields

I am trying to filter articles using custom fields
This is the example on the textpattern website

<txp:article_custom colour="red" />

and this is the sintax I am using, for a custom field named “Tipo de Ocio” and a value “Teatro”, in a section called “Ocio” like this:

<txp:article_custom limit="20" form="fichas" section="Ocio" Tipo de Ocio="Teatro"/>

but is not outputting anything at all.

Offline

#2 2009-05-05 09:06:15

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,456
Website GitHub

Re: filtering articles with custom fields

mlarino wrote:

<txp:article_custom limit="20" form="fichas" section="Ocio" Tipo de Ocio="Teatro"/>

I think it’s the spaces in your custom field name causing the problem.

Last edited by Bloke (2009-05-05 09:06:27)


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

#3 2009-05-05 09:11:00

mlarino
Member
Registered: 2007-06-29
Posts: 367

Re: filtering articles with custom fields

Hi Bloke!
tested that,
made a new tag with a different custom field

<txp:article_custom limit="20" form="fichas" section="Ocio" Zona-Madrid="Salamanca"/>

Still not showing any articles this way… :(

Could the custom_fields plugin be doing something that makes this tag obsolete?

Offline

#4 2009-05-05 09:12:20

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: filtering articles with custom fields

Sometimes reading docs might help and specially the tag reference

Custom names may include letters (uppercase or lowercase), numbers and under_scores, but no spaces or other special characters.

As variables can not consist those kind of things. Right now you are using something that is called the minus mark.

Last edited by Gocom (2009-05-05 09:13:22)

Offline

#5 2009-05-05 09:19:02

mlarino
Member
Registered: 2007-06-29
Posts: 367

Re: filtering articles with custom fields

Oh Oh…
If I edit the name of the custom field all the articles I have using that custom field wont change right? I can edit it with no problem.
I will try to do that and see how it goes.
Thanks!

Offline

#6 2009-05-05 09:26:31

mlarino
Member
Registered: 2007-06-29
Posts: 367

Re: filtering articles with custom fields

It Works!
Thank you both! I would read tag reference next time :)

Offline

Board footer

Powered by FluxBB