vBulletin Search Engine Optimization
This is a discussion on if condition help within the Link Building forums, part of the vBulletin SEO Discussion category; I hope it's not against terms to ask for help with basic coding, but it does pertain to links If ...
| |||||||
Enhancing 80 million pages. | Register | FAQ | Members List | Social Groups | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| if condition help
I hope it's not against terms to ask for help with basic coding, but it does pertain to links If it's not, feel welcome to delete it.... Just need a quick hand with a condition statement... I'm trying to use two different ad codes depending on if the member is male or female. I created a profile field for Man / Woman. I currently have: Code: <if condition="$post['field7'] == 'Man'"> <--code here for male members--> </if> <if condition="$post['field7'] == 'Woman'"> <--code here for female members--> </if> Any help, muchly appreciated. ETA: I mean, I know the above code works on the postbit and checks whether the member who posted is male or female... what I need it to do though, is check the reader's membership to field7 - whether they are male or female, and display ads according to the sex of the view - not the poster. In addition, I will be adding a condition based on the forumID. So for example, a man viewing a thread under the 'fathers forum' (say, ID=10) will see ads for (e.g.) "dads rights, thinning hair help, muscle building" while a woman would see ads similar, but based more towards their sex (e.g.) "safe sex, moms clubs, etc." - however, if a man viewed a different forum, e.g. 'health' , he'd see items relating to mens health - while women viewing the health forum would see ads directed towards women's health... long winded, but you get the idea I hope. |
|
#3
| |||
| |||
|
I think you can use Code: <if condition="$vbulletin->userinfo['field7'] == 'Man'"> <--code here for male members--> </if> <if condition="$vbulletin->userinfo['field7'] == 'Woman'"> <--code here for female members--> </if> |
|
#4
| |||
| |||
|
Michael, I'm trying to figure that code to work as a seperate template - so it can be used in other locations, such as showthread or even FAQ. It'll be wrapped into pages using vbadvanced. Arkidas, that worked a treat (at least the minor test I've done works) thank you! |
|
#7
| ||||
| ||||
|
I do it this way for my sidebar: Quote:
|
|
#12
| |||
| |||
|
Super. I have a very (very, very) basic understanding of this, but it's rather like a child's matchstick drawing of a 'sunny day at the park with daddy' vs michelangelo art exhibit. To be honest, it was more the 'in_array' that knocked my senses more then gist of the conditions themselves. |
|
#13
| ||||
| ||||
|
Personally I would rather use is_member_of then the $bbuserinfo, as it includes the secondary usergroups as well. Code: <if condition="(is_member_of($vbulletin->userinfo, 5, 6, 9, 11, 12, 13) AND $vbulletin->userinfo[field18] <> 'No') OR !is_member_of($vbulletin->userinfo, 5, 6, 9, 11, 12, 13)"> |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| More if condition help - search and searchid | jbartle | Template Modifications | 2 | 08-11-2007 06:50 PM |
| IF condition for certain pages? | jbartle | Off-Topic & Chit Chat | 9 | 01-03-2007 01:02 AM |
| if condition for admins and mods only | jbartle | Off-Topic & Chit Chat | 6 | 10-15-2006 12:56 AM |