Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2008-09-02 14:54:56

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

Re: How to group articles by custom field

robin746 wrote:

However the plugin is failing with this error:

Yeah, so it will give. It requires the value.

<txp:asy_wondertag>

Your first example/code block, you don’t need asy_wondertag in there. There isn’t any nesting.

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

#15 2008-09-02 15:37:37

robin746
Member
From: Ireland
Registered: 2007-09-22
Posts: 113
Website

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

#16 2008-09-02 15:39:56

robin746
Member
From: Ireland
Registered: 2007-09-22
Posts: 113
Website

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

Board footer

Powered by FluxBB