Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2018-11-17 17:02:10

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 6,911
Website

custom_field acrobatics

I have a custom field which I would like it to respond to 3 different conditions.

  1. The field is empty for which case it links to our home page
  2. The field has a url for which case we link to it
  3. The field has a # for which case I would like to show Off Line.

I have constructed the code below which works, but is there a way using txp tags which I can achieve the same results in a more economical way?

<txp:if_custom_field name="url">
<txp:if_custom_field name="url" value="#">
<p>Off line</p>
<txp:else />
<p><a rel="external" href="<txp:custom_field name="url" escape="" />">Website</a></p>
</txp:if_custom_field>
<txp:else />
<p><a href="<txp:site_url />" rel="home">Home</a></p>
</txp:if_custom_field>

Yiannis
——————————
neme.org | hblack.net | LABS | State Machines | NeMe @ github

Offline

Board footer

Powered by FluxBB