Webmastersite.net
Register Log In

Conditionals based on custom field..

Comments on Conditionals based on custom field..

freshwill
Member

Usergroup: Customer
Joined: Sep 30, 2005

Total Topics: 7
Total Comments: 20
Posted Oct 04, 2005 - 2:49 AM:

hello, what's the sure fire way to conditionally show something (an image, word, text,etc) based on whether information is filled out in a custom field.
For example, we have a custom text field called 'id'. If this 'id' is blank, don't display the image. Else if filled, display the image.

I can't seem to find reference for this. Similar to the 'hide', i guess. Please point me in the right path. Thanks!
mrowton
Forum Regular

Usergroup: Customer
Joined: Feb 19, 2004
Location: Michigan

Total Topics: 57
Total Comments: 185
mrowton
Posted Oct 04, 2005 - 3:01 AM:

Seems like you would have problems if you made a field called "id"

But as an example if you made a custom link field called "customid" then the below would work.

<IF {LINKCUSTOMID}>
This appears if there is something in the field
<OTHERWISE>
This appears if there is nothing there
</IF>


freshwill
Member

Usergroup: Customer
Joined: Sep 30, 2005

Total Topics: 7
Total Comments: 20
Posted Oct 04, 2005 - 11:47 AM:

Thanks, for some stupid reason, I was using:

<IF {LINKCUSTOMID} is greater than 0>
This appears if there is something in the field
<OTHERWISE>
This appears if there is nothing there
</IF>

Using an example on the displaylinks.tpl page.
This gave me errors. But your way helped. Thanks!
freshwill
Member

Usergroup: Customer
Joined: Sep 30, 2005

Total Topics: 7
Total Comments: 20
Posted Oct 04, 2005 - 11:50 AM:

how about this one...

<IF {LINKCUSTOMID}>
show A
<else>
show b
<else>
show c
<else>
show d
</if>

is <else> = <otherwise>? And would a conditional like this work by stackin <otherwise>?
mrowton
Forum Regular

Usergroup: Customer
Joined: Feb 19, 2004
Location: Michigan

Total Topics: 57
Total Comments: 185
mrowton
Posted Oct 04, 2005 - 1:33 PM:

Notice the bottom example
scripts.webmastersite.net/w...inks/wsnmanual/articles/69


Paul, I just previewed this message and got the below. Not sure exactly what I typed to get it.
Couldn't find an unused name for . There's got to be a bug in this script if you see this. (Find me in filefunctions.php)
Paul
developer

Usergroup: Administrator
Joined: Dec 20, 2001
Location: Diamond Springs, California

Total Topics: 61
Total Comments: 7868
Paul
Posted Oct 05, 2005 - 2:04 PM:

freshwill, there's no logic to multiple elses and there's no else if construction, though you can use PHP for that and mixing PHP with conditionals is fine.
Search thread for
Download thread as
  • 0/5
  • 1
  • 2
  • 3
  • 4
  • 5



This thread is closed, so you cannot post a reply.