Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Offline
#14 2008-09-02 15:36:47
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: How to group articles by custom field
robin746 wrote:
Next thing: fix chs_urlvar_exists().
This is ok. But why waste time fixing a plugin when smd_if has everything you need?
Offline
Re: How to group articles by custom field
Thanks for the help!
For those following along I have figured out the structure that works. My main page has different code for each section. Here is the code for the particular section in question. If there are no URL parameters it displays the sticky articles. There is one of these per colour. If the parameter “colour” does exist this code displays the live articles in pages of four.
<txp:if_section name="colours">
<txp:chs_urlvar_notexists var="colour">
<txp:article form="colour-headers" section="colours" status="sticky" />
</txp:chs_urlvar_notexists>
<txp:chs_urlvar_exists var="colour">
<txp:php>
echo '<txp:article form="colour-details" section="colours" status="live" limit="4" pageby="4" colour="' . gps("colour") . '" />';
</txp:php>
</txp:chs_urlvar_exists>
</txp:if_section>
The PHP code block is required to build the correct article form tag.
This code uses the two custom functions I (re-)wrote earlier.
robin
Offline
Re: How to group articles by custom field
redbot wrote:
But why waste time fixing a plugin when smd_if has everything you need?
Because I was already familiar with the code and it took me a few minutes — shorter than it would have taken just to find and install YAP (Yet Another Plugin). However I will have a look at smd_if later when I have a moment. At this time I was goal-focused on a particular problem domain. You know how it is!
robin
Offline
#17 2008-09-02 15:42:54
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: How to group articles by custom field
robin746 wrote:
… At this time I was goal-focused on a particular problem domain. You know how it is!
ok ;)
Offline