Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-10-06 06:35:20

brianlux0r
Member
Registered: 2007-06-04
Posts: 41

if custom_field != null then....

Hi I have added custom fields for my article data, which I would like to display conditionally.

For example, if I have a custom field for a h1 tag for a particular article and I do not fill in the h1 custom field for this article, I would like to abort the display of the html + tag data.

is there a way to translate this into textpattern:

if <txp:custom_field name=“whATever” /> != NULL then display <h1>whatever</h1>

Offline

#2 2007-10-06 08:04:42

sthmtc
Member
From: CGN, GER
Registered: 2005-01-17
Posts: 586
Website

Re: if custom_field != null then....

if_custom_field

or, more general, chh_if_data

Offline

#3 2007-10-06 22:01:23

brianlux0r
Member
Registered: 2007-06-04
Posts: 41

Re: if custom_field != null then....

so ez.. thanks a lot

Offline

#4 2007-10-07 06:37:26

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: if custom_field != null then....

You actually don’t need the if data plugin

you could achieve what you need just with native tags

<txp:if_custom_field name=“whATever” /><txp:custom_field name=“whATever” /><txp:else /><h1>whatever</h1></txp:if_custom_field>


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#5 2007-10-07 08:53:00

sthmtc
Member
From: CGN, GER
Registered: 2005-01-17
Posts: 586
Website

Re: if custom_field != null then....

colak wrote:

You actually don’t need the if data plugin

that’s exactly what the if_custom_field link in my post pointed to :) just thought i’d link to chh_if_data aswell, as it comes in handy in a lot of situations and is a more general approach.

Offline

#6 2007-10-07 09:51:08

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: if custom_field != null then....

Hi sven
I like and use the chh_if data plugin too. I just thought that there was no reason for brianlux0r to use it as what he was looking for could be achieved with native tags.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB