Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-07-18 15:53:09

THE BLUE DRAGON
Member
From: Israel
Registered: 2007-11-16
Posts: 638
Website

Article_custom - if 1 of 3 custom fields exist

Hey!
I have a article_custom and I want to limit it to 3 custom fields if one of them exist.
regularly if it’s only one cusom field, then I use the customfieldname="value" attribute.

Yes I can do it messy as:

<txp:article_custom section="section-name">
     <txp:if_custom_field name="bla1">
          <txp:article_custom section="section-name" bla1="value" />
     <txp:else />
     <txp:if_custom_field name="bla2">
          <txp:article_custom section="section-name" bla2="value" />
     <txp:else />
          <txp:article_custom section="section-name" bla3="value" />
     </txp:if_custom_field>
     </txp:if_custom_field>
</txp:article_custom>

but is there a better way to do this please?
(maybe using txp:variable or something?)

Offline

#2 2010-07-18 20:28:41

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

Re: Article_custom - if 1 of 3 custom fields exist

Try regex. This should work:

<txp:article_custom blah1="_%" blah2="_%" bla3="_%" />

PS. In your example you have nested articles lists, which you wouldn’t want to do ;-) If you did use that, you would want to remove the nested lists.

Offline

Board footer

Powered by FluxBB