PDA

View Full Version : If Conditional - Custom Profile Field


req2d
07-22-2007, 11:46 AM
Hi,

Running into some trouble finding an old thread on this.

I have 2 profile fields, 1 is a radio button between Yes / No and the other is a text box.

I'd like to be able to say in my postbit...

If Field1 = Yes
Then Show Field2

Many thanks in advance for any help !

Cheers

Dismounted
07-22-2007, 11:54 AM
<if condition="$post[field1]">
$post[field2]
</if>
Change the 1 & 2 in $post[field1] & $post[field2] to the field numbers.

req2d
07-22-2007, 12:00 PM
Thanks Dismounted :)

If there is any difference if I have 3 options (single selection menu)?

1) Off - no change
2) On1 - "show etc.. etc.."
3) On2 - "show etc.. etc.. 2"

Cheers :)

Dismounted
07-22-2007, 12:02 PM
Will the two "on" switches show the same thing?

req2d
07-22-2007, 12:04 PM
They would each show [field1].gif and [field2].gif

Thanks for your help btw :)

Dismounted
07-22-2007, 12:21 PM
So it's like this?

If menu is "On1",
Show field1.gif

If menu is "On2",
Show field2.gif

Side Note: That looks awfully like Visual Basic :p.

req2d
07-22-2007, 12:25 PM
LOL, true :)

But yep, that's exactly it.

Dismounted
07-22-2007, 12:32 PM
<if condition="$post[fieldx] === '2'">
<img src="$post[field1].gif" border="0" alt="" />
</if>
<if condition="$post[fieldx] === '3'">
<img src="$post[field2].gif" border="0" alt="" />
</if>
Change x in $post[fieldx] to the menu field id.
Change the 1 & 2 in $post[field1] & $post[field2] to the field numbers.

req2d
07-22-2007, 12:34 PM
Anyway I can display this with multiple selections?

<if condition="$post[field5] === '2'">

i.e. <if condition="$post[field5] === '2, 3, 4"> etc.?

Cheers :)

Kirk Y
07-22-2007, 06:02 PM
<if condition="$post[field5] === '2' OR $post[field5] === '3' OR $post[field5] === '4'">OR:

<if condition="in_array($post[field5], array(2,3,4))">

req2d
07-22-2007, 08:02 PM
Thank you sir :)