PDA

View Full Version : How To Display Multiple Selection Profile Fields


Wired1
08-31-2006, 08:16 PM
<a href="http://www.vbulletin.com/forum/showthread.php?t=108785" target="_blank">http://www.vbulletin.com/forum/showthread.php?t=108785</a>

Ok, so I've seen this thread and all, but I'm trying to figure out a way to have it automatically grab the appropriate field info for each checkbox. Not entirely sure where to look / call for that info. Any ideas?

Wired1
09-05-2006, 12:53 AM
Bump. Anyone have an idea, or need more info?

cavyspirit
09-05-2006, 10:46 PM
Ditto for me. I need this, too.

I can't figure out that post either. I need to be able to display the data.

peterska2
09-05-2006, 10:56 PM
I know what you are wanting to do, but to do it automatically without doing the massive conditional set I don't think is possible - I could be proven wrong there though.

Wired1
09-06-2006, 12:02 AM
not looking for a way around the conditional, just a way to grab the appropriate info after the conditional is met.

peterska2
09-06-2006, 01:54 AM
ah, well the only way to do it properly is the way that is posted in the thread you linked to.

Wired1
09-06-2006, 02:34 AM
The thread DOESN'T say how to show the info though.

To clarify:

that thread only gives code that allows you to detect if a particular checkbox is checked, and if so, to do <SOMETHING>. I'm looking for additional code that will ultimately display the checkbox field's name.

Example:

Let's say you have three checkboxes, A, B, C. You check A and C. Currently with the linked to code, you can detect which boxes were checked, but not pull and display the name of the checkbox, unless I'm missing something. If so, please correct me.

peterska2
09-06-2006, 12:52 PM
With multiple selection profile fields I'm 99% sure that you have to hardcode what you want them to display as the output is the option number values.

So for example, lets say that field 7 is about pets, then you would have
<if condition="$comma = ''"></if>

<if condition="$post['field7'] & 1">
$comma Dog
<if condition="$comma = ', '"></if>
</if>
<if condition="$post['field7'] & 2">
$comma Cat
<if condition="$comma = ', '"></if>
</if>
<if condition="$post['field7'] & 4">
$comma Rabbit
<if condition="$comma = ', '"></if>
</if>
<if condition="$post['field7'] & 8">
$comma Hamster
<if condition="$comma = ', '"></if>
</if>
<if condition="$post['field7'] & 16">
$comma Horse
<if condition="$comma = ', '"></if>
</if>
<if condition="$post['field7'] & 32">
$comma Fish
<if condition="$comma = ', '"></if>
</if>
<if condition="$post['field7'] & 64">
$comma Snake
<if condition="$comma = ', '"></if>
</if>
<if condition="$post['field7'] & 128">
$comma Bird
<if condition="$comma = ', '"></if>
</if>Of course, using phrases for the display text is much better, so you would do that automatically when inputting your code into the template.

tommyxv
09-06-2006, 01:54 PM
I have profile drop downs for Year, Make, Model for an automotive website and to display the info in the postbit I use this....

<if condition="$post['field11'] AND $post['field12'] AND $post['field13']"><div><b>$post[field11] $post[field12] $post[field13]</b></div></if>


They must have all 3 filled in for it to show.

Wired1
09-08-2006, 05:39 AM
With multiple selection profile fields I'm 99% sure that you have to hardcode what you want them to display as the output is the option number values.I'm looking for a way to get the field option names from the database though, and not having to hard code it. There are various hacks that slap profile fields into the postbit, and when multiple selection ones are done, it posts just the bitcount, which isn't helpful to the end user.


I have profile drop downs for Year, Make, Model for an automotive website and to display the info in the postbit I use this....

<if condition="$post['field11'] AND $post['field12'] AND $post['field13']"><div><b>$post[field11] $post[field12] $post[field13]</b></div></if>


They must have all 3 filled in for it to show.Thanks for trying to help, but that's got nothing to do with my question, sorry! I'm trying to find out how to grab the name of each checkbox from the backend, or at least where they're located.

Wired1
09-11-2006, 04:10 AM
Ok, an update:

it's in the PROFILEFIELD table.

Example of the code, as well as a breakdown:

Main things to know:

profileid = (whatever)
type = 'checkbox'
data = a:6:{i:0;s:3:"ONE";i:1;s:3:"TWO";i:2;s:5:"THREE";i:3;s:4:"FOUR";i:4;s:4:"FIVE";i:5;s:3:"SIX";}

The data field broken down a bit:

a:6:{

i:0;s:3:"ONE";
i:1;s:3:"TWO";
i:2;s:5:"THREE";
i:3;s:4:"FOUR";
i:4;s:4:"FIVE";
i:5;s:3:"SIX";

}

a:6 means an array of 6 fields

i:<VARIABLE 1>;s:<VARIABLE 2>:"CHECKBOX NAME";

example: i:0;s:3:"ONE";

i:0 (i stands for ID) is the first checkbox;
s:3 (s stands for STRING) indicates how many characters in the checkbox name
"CHECKBOX NAME" - self explanatory :)

Wired1
09-26-2006, 01:55 AM
Any ideas on how to make this easy?

I think some REGEXP would be needed, and man it's been a while lol.

Neutral Singh
01-26-2007, 11:05 AM
I have been looking for this mod for ages without success. Anybody please guide me.