PayBas
03-01-2007, 01:56 PM
Hello, I am seeking to create the following functionality for my forum.
I want the avatars of users to be displayed depending on what information they have selected from the custom user profilefields I have created.
Basically, there are 4 Single-Selection Menus that each have about 10 options. I want different combinations to result if different avatars.
There are about 350 different combinations (and avatars). Luckily there is some systematic avatar image naming but thats about it.
For example:
Field 1: option 4
Field 2: option 1
Field 3: option 8
Field 4: option 5
Should result in:
images/avatars_4/1-8-5.gif
Now my question... what would be the most efficient way to code this?
Obviously coding this through vBulletin <if> statements in the postbit template would do the trick, but would be a total pain in the *** to code, plus I don't think it is efficient at all.
But what would be the best way? I was thinking of using javascript to handle this and to make it through variables (avatars_w/x-y-z.gif) but I'm not sure if this will work.
Any advice would be appreciated.
Although a more basic question would be if this whole feature is best handled serverside or clientside... I'm pretty bad at writing php and plugins for serverside implementation but im learning java as we speak.
Update: beginning to wonder if a method through javascript is even possible...
<if condition="$post['field5'] & 1"><img src="/images/icon/race/1-0.gif" border="0"></if>
<if condition="$post['field5'] & 2"> <img src="/images/icon/race/1-1.gif" border="0"></if>
<if condition="$post['field5'] & 4"><img src="/images/icon/race/2-0.gif" border="0"></if>
<if condition="$post['field5'] & 8"><img src="/images/icon/race/2-1.gif" border="0"></if>
<if condition="$post['field5'] & 16"><img src="/images/icon/race/3-0.gif" border="0"></if>
<if condition="$post['field5'] & 32"><img src="/images/icon/race/3-1.gif" border="0"></if>
Haven't got a clue how to convert the $post['field5'] & 32 to a meaningfull clientside script, how would this be linked in the first place? It would have to read the output of the generated code... perhaps making a plugin was the better choice after all.
I want the avatars of users to be displayed depending on what information they have selected from the custom user profilefields I have created.
Basically, there are 4 Single-Selection Menus that each have about 10 options. I want different combinations to result if different avatars.
There are about 350 different combinations (and avatars). Luckily there is some systematic avatar image naming but thats about it.
For example:
Field 1: option 4
Field 2: option 1
Field 3: option 8
Field 4: option 5
Should result in:
images/avatars_4/1-8-5.gif
Now my question... what would be the most efficient way to code this?
Obviously coding this through vBulletin <if> statements in the postbit template would do the trick, but would be a total pain in the *** to code, plus I don't think it is efficient at all.
But what would be the best way? I was thinking of using javascript to handle this and to make it through variables (avatars_w/x-y-z.gif) but I'm not sure if this will work.
Any advice would be appreciated.
Although a more basic question would be if this whole feature is best handled serverside or clientside... I'm pretty bad at writing php and plugins for serverside implementation but im learning java as we speak.
Update: beginning to wonder if a method through javascript is even possible...
<if condition="$post['field5'] & 1"><img src="/images/icon/race/1-0.gif" border="0"></if>
<if condition="$post['field5'] & 2"> <img src="/images/icon/race/1-1.gif" border="0"></if>
<if condition="$post['field5'] & 4"><img src="/images/icon/race/2-0.gif" border="0"></if>
<if condition="$post['field5'] & 8"><img src="/images/icon/race/2-1.gif" border="0"></if>
<if condition="$post['field5'] & 16"><img src="/images/icon/race/3-0.gif" border="0"></if>
<if condition="$post['field5'] & 32"><img src="/images/icon/race/3-1.gif" border="0"></if>
Haven't got a clue how to convert the $post['field5'] & 32 to a meaningfull clientside script, how would this be linked in the first place? It would have to read the output of the generated code... perhaps making a plugin was the better choice after all.