Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-07-19 17:17:07

ploinkr
Member
From: Montreal
Registered: 2007-12-06
Posts: 83

Different layout depending on # of articles

Hello, I’m just wondering if this can be done: what I need basically is to use a specific layout when there’s only 1 article in a certain category, then a different layout if there’s 2, then 3, etc. I checked the mdn_count plugin but I don’t think that can really help.

Any suggestion?
Thanks in advance,
Ben

Offline

#2 2011-07-19 18:17:22

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,258
Website GitHub Mastodon Twitter

Re: Different layout depending on # of articles

Hi Ben

Although you might be right, I can’t see why mdn count wouldn’t work. The code below is untested

<txp:variable name="countarticles" value='<txp:mdn_count category=''<txp:category />'' section=''<txp:section />'' />'  />
<txp:if_variable name="countarticles" value="1">
There is only 1 article
<txp:else />
There are no or many articles.
</txp:if_variable>

Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2011-07-19 18:32:14

ploinkr
Member
From: Montreal
Registered: 2007-12-06
Posts: 83

Re: Different layout depending on # of articles

Thanks very much Yiannis, I’m gonna try that : )
Ben

Offline

#4 2011-07-19 20:10:50

ploinkr
Member
From: Montreal
Registered: 2007-12-06
Posts: 83

Re: Different layout depending on # of articles

So far so good! Thanks again :D
Ben

Offline

Board footer

Powered by FluxBB