Textpattern CMS support forum

You are not logged in. Register | Login | Help

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

From: Cyprus
Registered: 2004-11-20
Posts: 7,289

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:else />
<p><a href="<txp:site_url />" rel="home">Home</a></p>

neme.org | hblack.net | LABS | State Machines | Respbublika! | NeMe @ github


Board footer

Powered by FluxBB