Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-04-13 02:28:20

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

image based on category

i feel like this is one of those that gets asked a lot. i’m trying to build a conditional for posts. if they belong to a certain category they will get a particular image.
i did try if_article_category with an <else /> statement too, they both didnt work.

<txp:if_article_category name=“blog”>
<txp:ras_if_article_image>
<txp:permlink><txp:article_image thumbnail=“1” /></txp:permlink>
<txp:else />
<txp:permlink><txp:image id=“18” /></txp:permlink>
</txp:ras_if_article_image>
</txp:if_article_category>

Last edited by mrtunes (2009-04-13 02:29:32)

Offline

#2 2009-04-13 03:00:26

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: image based on category

The tag set as you have it above works as advertised for me, what breaks for you?

Offline

#3 2009-04-13 03:07:59

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

Re: image based on category

rsilletti wrote:

The tag set as you have it above works as advertised for me, what breaks for you?

all the images disappear. your ras plugin is working fine though, i checked that.

also i’m not using article custom;

<ul id=‘coolstuff’>
<txp:article form=“cool” limit=“9” pgonly=“0” />
</ul>

Offline

#4 2009-04-13 03:17:15

rsilletti
Moderator
From: Spokane WA
Registered: 2004-04-28
Posts: 707

Re: image based on category

I had to re-key quotes around attributes when I pasted the code from the forum?, but there is no reason why if_article_category shouldn’t work – the tag layout makes sense.

Offline

#5 2009-04-13 04:41:26

mrtunes
Member
From: Toronto, On
Registered: 2007-03-12
Posts: 575
Website

Re: image based on category

rsilletti wrote:

I had to re-key quotes around attributes when I pasted the code from the forum?, but there is no reason why if_article_category shouldn’t work – the tag layout makes sense.

ok got it working! it appears as if categories names are very case sensitive. i think i get confused cause there’s the “name” and the “title”. will pay closer attention to this in the future :)

Offline

Board footer

Powered by FluxBB