Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
is there a Txp if/else equivalent
Curious If Textpattern tags allow for if/else based on a url title is equal to, do this, else, not.
{if article_id_12 == ""}
<li class="active"><a href="https://textism.ca/brands/logo_ford/"> </a></li>
{/if}
{if article_id_12 != ""}
<li><a href="https://textism.ca/brands/logo_ford/"> </a></li>
{/if}
it would be cool if there was.
…. texted postive
Offline
Re: is there a Txp if/else equivalent
This, maybe?
<txp:if_custom_field name="url_title" value="title_to_match">
yep
<txp:else />
nope
</txp:if_custom_field>
Offline
Re: is there a Txp if/else equivalent
And as an extra, if it’s just to set the class="active" on the currently shown article, you can do:
<li<txp:if_article_id> class="active"</txp:if_article_id>>
<txp:permlink><txp:title /></txp:permlink>
</li>
TXP Builders – finely-crafted code, design and txp
Offline
Pages: 1