Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Design and Graphics Discussions
  #1  
Old 02-23-2011, 07:56 AM
madshark's Avatar
madshark madshark is offline
 
Join Date: Oct 2009
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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">
on 4.0.3 or the likes.

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.
Reply With Quote
  #2  
Old 02-23-2011, 05:05 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What template are you putting this in? And can we see exactly what you are adding and where?
Reply With Quote
  #3  
Old 02-23-2011, 05:30 PM
madshark's Avatar
madshark madshark is offline
 
Join Date: Oct 2009
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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;
}
So in theory and again if memory serves me well the code should look something like this I take it...

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>
Im fairly certain I used something very similar to the above. For some reason it seems to break the whole post bit this time around. However if i just switch the userinfo to userinfo1 minus the conditional the post bit displays the userinfo on the right with no issue. So the css seems to be problem free.

Any ideas?

Thanks.
Reply With Quote
  #4  
Old 02-23-2011, 05:35 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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">
It works fine on my forum if I change that line to have different classes.
Reply With Quote
  #5  
Old 02-23-2011, 06:19 PM
madshark's Avatar
madshark madshark is offline
 
Join Date: Oct 2009
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 ?
Reply With Quote
  #6  
Old 02-23-2011, 08:25 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #7  
Old 02-26-2011, 05:41 AM
madshark's Avatar
madshark madshark is offline
 
Join Date: Oct 2009
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:59 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07703 seconds
  • Memory Usage 2,217KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (1)bbcode_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete