Log in

View Full Version : If ?


rogersnm
06-17-2006, 01:38 PM
I have made a costom profile field with the following:
Add new: Multiple Selection Checkbox.
Title: Postbit
Description: Show bits of info in the postbit?
Limit Selection: 0
Items Per Line: 1
Options: option 1
option 2
option 3
option 4
option 5
option 6
option 7
option 8
Display Order: 6
Field Required: No
Field Editable by User: Yes
Private Field: No
Field Searchable on Members List: No
Show on Members List: No
Which page displays this option?: Options: Other
In a template how do i use an if statement so if option 8 is checked then it will do whatever. And the same for option 1 and all the other options.

NOTE: there are multiple checkboxes in the 1 field and using <if condition="$post[fieldX] == 'option 1'"> didn't work.

peterska2
06-17-2006, 08:46 PM
Option 1:<if condition="$post[fieldx]=='1'">
Option 2:<if condition="$post[fieldx]=='2'">
Option 3:<if condition="$post[fieldx]=='4'">
Option 4:<if condition="$post[fieldx]=='8'">
Option 5:<if condition="$post[fieldx]=='16'">
Option 6:<if condition="$post[fieldx]=='32'">
Option 7:<if condition="$post[fieldx]=='64'">
Option 8:<if condition="$post[fieldx]=='128'">

Note: With checkboxes, the total is cumlutive so if they have checked boxes 1,3,5 & 7 then they will have a fieldx value of 85 so you would need to calculate the values for each possible combination and use a large amount of if conditions to get the effect that you want.

I recommend using individual options for each one then you can toggle the information on and off.