The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Picking Alternate Posts With A Conditional
I'm trying to pick out ever alternating post with a conditional. I recall successfully doing this with
Code:
<vb:if condition="$post['postcount'] % 2 == 0"> However with 4.1.2 it doesn't seem to work. Or I just cant remember the correct coding. Could anyone please shed some light? A typical usage would be to have alternating postbit colours. Thank You. |
#2
|
||||
|
||||
What template are you putting this in? And can we see exactly what you are adding and where?
|
#3
|
||||
|
||||
I basically want the postbit userinfo to alternate. Left and Right. Ive done it before. I just haven't used VB for awhile and cant remeber how the heck I did it for the life of me as my forum was pretty much closed down.
What I do know is that I used it in the postbitlegacy template. And basically I used a second CSS for userinfo (i.e userinfo1) with a float right. Code:
.postbitlegacy .userinfo1 { float:{vb:stylevar right}; position: relative; width:{vb:math {vb:stylevar postbitlegacy_userinfo_width}-{vb:math {vb:stylevar padding}*2}}; padding: 2px {vb:stylevar padding} {vb:math {vb:stylevar padding}/2}; font-size: {vb:stylevar small_fontSize}; display:block; background: {vb:stylevar postbit_userinfo_background}; clear:both; } Code:
<div class="postdetails"> <vb:if condition="$post['postcount'] % 2 == 0"><div class="userinfo"><vb:else /><div class="userinfo"></vb:if> <div class="username_container"> <vb:if condition="$post['userid']"> {vb:raw memberaction_dropdown} {vb:raw post.onlinestatus} <vb:else /> <span class="username guest">{vb:raw post.musername}</span> </vb:if> </div> Any ideas? Thanks. |
#4
|
||||
|
||||
You do see that you have the same class in both the if and else?
HTML Code:
<div class="userinfo"><vb:else /><div class="userinfo"> |
#5
|
||||
|
||||
My bad I typed that out half asleep. whee hours of the morning here lol. Pretty sure I used different classes when I tried it.
Odd. I shall check it again in the a.m and post back. But basically you implemented exactly what I posted above yes ? |
#6
|
||||
|
||||
I implemented the class change in my postbit_legacy and it worked. I did not check your CSS, but the class is definitely changing in alternate posts.
|
#7
|
||||
|
||||
The CSS needed to be changed in more than one place. Postdetails needed to be aligned as well. And another conditional needed to be added. Not too shabby.
Thanks Lynne |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|