Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-02-26 21:25:10

bmsorg
New Member
Registered: 2009-02-25
Posts: 7

Permlink as condition of whether any values exist in article Body

I am outputting articles as a product listing. Some of the products have product info in the Body of the article, while some don’t. In my listing of the products/articles, I want the products titles that have content in the Body field to permlink to themselves (this is easy, obviously) while the products that do not have any content to just appear as text, not permlinking to themselves.

Is there some way in my form that will be used to output these articles listings, to say…

if this article has nothing in the body, do not permlink to this title,
while if this article has anything in the value, permlink to this title

Thanks!

Offline

#2 2009-02-26 21:45:43

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: Permlink as condition of whether any values exist in article Body

<txp:variable name="has_body" value='<txp:body />' />
<txp:if_variable name="has_body" value="">
<txp:title />
<txp:else />
<txp:permlink><txp:title /></txp:permlink>
</txp:if_variable>

La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#3 2009-02-26 22:02:11

bmsorg
New Member
Registered: 2009-02-25
Posts: 7

Re: Permlink as condition of whether any values exist in article Body

Thanks so much. I never really understood the variable tag, and this opens up a lot of ideas now.

Cheers! Brandon

Offline

Board footer

Powered by FluxBB