Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-02-25 13:52:52

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

show stickies from categories OTHER than currently viewed one

In a category page, I want to display sticky articles from other categories (I’ve used stickies to create ‘category summary’ articles).

I imagined I could call a category-sensitive sticky article and in the form use the chh_related_articles plugin.

in my page template
<txp:article form="category_teaser4_others" status="sticky" limit="1" />

and in the category_teaser4_others form
<txp:chh_related_articles relation="section" form="category_teaser4" status="sticky" limit="2" />

but it seems I can’t specify the status of the related articles.

Is it possible to do this without resorting to php hijinks? I’d post this in the plugin thread but I suspect it’ll need a totally new approach.

many thanks
Stu

Offline

#2 2008-02-25 20:13:39

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: show stickies from categories OTHER than currently viewed one

Do I understand correctly that you want sticky articles from other categories, but in the same section? If so, wouldn’t something like this work instead of chh_related_articles (with asy_wondertag):

<txp:asy_wondertag>
   <txp:article_custom section="<txp:section />" form="category_teaser4" status="sticky" limit="2" />
</txp:asy_wondertag>

Offline

#3 2008-02-25 20:25:10

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: show stickies from categories OTHER than currently viewed one

Hi Els
That is what I’m after, yep. The method you suggest would work if I could exclude the current category, something like:

<txp:asy_wondertag>
   <txp:article_custom section="<txp:section />" category!="<txp:category />" form="category_teaser4" status="sticky" limit="2" />
</txp:asy_wondertag>

Offline

#4 2008-02-25 21:24:43

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: show stickies from categories OTHER than currently viewed one

Ah of course. A pity. Would smd_if be useful here?

Offline

#5 2008-02-26 12:52:01

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: show stickies from categories OTHER than currently viewed one

Looks tasty – hadn’t noticed that plugin before…

OK, so I think this should work, but naturally it doesn’t. It outputs one article – “doh!”, but nothing at all for the 2nd article call – which should pull one from 4 valid articles via the else.

Have I missed anything obvious?

page template

             <txp:article form="category_teaser4" status="sticky" limit="2" />

category_teaser4 form

             <txp:asy_wondertag>
               <txp:smd_if field="category1" operator="eq" value="<txp:category />">doh!<txp:else />
                 <h4><a title="browse articles in this category" href="/<txp:section />/<txp:category1 />"><txp:category1 title="1" /></a></h4>
                 <txp:body />
               </txp:smd_if>
             </txp:asy_wondertag>

thanks
Stu

Offline

#6 2008-02-26 12:54:46

pieman
Member
From: Bristol, UK
Registered: 2005-09-22
Posts: 491
Website

Re: show stickies from categories OTHER than currently viewed one

I can of course answer that myself.

<txp:article form="category_teaser4" status="sticky" limit="2" /> is category sensitive so it would never pull an article from another unspecified cat..

<txp:article_custom form="category_teaser4" status="sticky" limit="2" /> does the trick nicely.

thanks for your help Els

Offline

Board footer

Powered by FluxBB