Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-06-08 18:10:33

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

hyphen on custom field names + article_custom

Hi.

As you may know, a custom field name can be used as an attribute for txp:article_custom
Doing that, the output will be restricted to only articles that have that custom field filled with some particular value.

For example (being “featured” the name of a custom field):
<txp:article_custom featured="yes" />

It will list just those articles that have “yes” as the value for the custom field “featured”.

Now, the problem: if the custom field name has an hyphen, then the filtering doesn’t work.

For example (being “featured-article” the name of a custom field):
<txp:article_custom featured-article="yes" />

That won’t work (at least, on a 4.0.6 installation) :(
The workaround: use an underscore (“featured_article” and <txp:article_custom featured_article="yes" />) and it will work.

Can anyone confirm if this is a bug/issue or if hyphen are prohibited in custom field names?


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#2 2008-06-08 19:13:02

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

Re: hyphen on custom field names + article_custom

Custom names may include letters (uppercase or lowercase), numbers and under_scores, but no spaces or other special characters. [From Textbook BTW: I find an underscore a more special character than a hyphen.

Last edited by uli (2008-06-08 19:14:51)


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

Offline

#3 2008-06-08 19:35:11

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: hyphen on custom field names + article_custom

Thanks for clarifying, uli. I should have taken a look at the textbook.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#4 2008-06-10 05:18:09

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

Re: hyphen on custom field names + article_custom

FYI, it is a PHP limitation.

Offline

Board footer

Powered by FluxBB