Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2006-06-20 01:18:24
- supafunk
- Member
- Registered: 2006-03-05
- Posts: 15
Showing only articles with a specific custom field value
In my page template I’m simply using the code:
<code>
<txp:article customfieldname=“customfieldvalue” />
</code>
but I still get an article list containing all articles (although I’m only testing with a couple at the moment), not just the one with the specified value for the specified custom field. I’ve read sooo much documentation and still can’t figure out what I’m doing wrong.
Once again, any help is much appreciated.
Last edited by supafunk (2006-06-20 01:19:13)
Offline
Re: Showing only articles with a specific custom field value
can you post the exact code you used?
Offline
#3 2006-06-20 12:00:15
- supafunk
- Member
- Registered: 2006-03-05
- Posts: 15
Re: Showing only articles with a specific custom field value
I’m using the chs_if_urlvar plugin so the code looks like this:
<code>
<txp:chs_urlvar_default var=“view”>
<txp:article />
</txp:chs_urlvar_default>
<txp:chs_if_urlvar var=“view” value=“dsortbyprice”>
<txp:article sortby=“custom_3” sortdir=“desc” section=“resources” />
</txp:chs_if_urlvar>
<txp:chs_if_urlvar var=“view” value=“asortbyprice”>
<txp:article sortby=“custom_3” sortdir=“asc” section=“resources” />
</txp:chs_if_urlvar>
<txp:chs_if_urlvar var=“view” value=“showonlyphp”>
<txp:article Language=“PHP” />
</txp:chs_if_urlvar>
</code>
Everything works fine, except for the last one which shows all articles rather than just those which have the value “PHP” in their custom field named Language. It’s not to do with the case, I messed around with that. It also doesn’t seem to work when using any of my custom fields so I must be doing something wrong here :)
All that code is in my page template btw.
Cheers
Last edited by supafunk (2006-06-20 12:02:09)
Offline