Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 02-20-2010, 11:46 PM
way2xtreme way2xtreme is offline
 
Join Date: Oct 2006
Posts: 104
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Please help: making alternating row background color in threadbit?

Hi

I am trying to set alternating row background color in threadbit. After searing around, I found this:
http://www.vbulletin.com/forum/showt...=1#post1490421

I altered the code (see below) and tried it to find I am getting only "alt1" from {vb:raw $altclass} .

Maybe there's something else I need to do?

Please help and thank you in advance

WC


Code:
<vb:if condition="!isset($altrow)">
<vb:if condition="$altrow = 0"></vb:if>
</vb:if>
<vb:if condition="++$altrow % 2 == 0">
<vb:if condition="$altclass = 'alt2'"></vb:if>
<vb:else />
<vb:if condition="$altclass = 'alt1'"></vb:if>
</vb:if>

...{vb:raw $altclass}
Reply With Quote
  #2  
Old 02-21-2010, 02:39 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmmm, haven't really tried anything like that in vB4, but did you try either preregistering the variable or creating one in an array that is already registered? ($post['altclass'] ?)
Reply With Quote
  #3  
Old 02-21-2010, 07:30 PM
way2xtreme way2xtreme is offline
 
Join Date: Oct 2006
Posts: 104
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
Hmmm, haven't really tried anything like that in vB4, but did you try either preregistering the variable or creating one in an array that is already registered? ($post['altclass'] ?)
Thanks Lynne

I don't really know how to do that. Do I just replace $altclass with $post['altclass'] ?

Code:
<vb:if condition="!isset($altrow)">
<vb:if condition="$altrow = 0"></vb:if>
</vb:if>
<vb:if condition="++$altrow % 2 == 0">
<vb:if condition="$post['altclass']  = 'alt2'"></vb:if>
<vb:else />
<vb:if condition="$post['altclass'] = 'alt1'"></vb:if>
</vb:if>

then put class=" {vb:raw $post['altclass'] } "
Reply With Quote
  #4  
Old 02-21-2010, 07:58 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try it and see. (You forgot the ones in the top four rows.)
Reply With Quote
  #5  
Old 02-21-2010, 08:07 PM
ForumsMods ForumsMods is offline
 
Join Date: Aug 2007
Location: Argentina
Posts: 667
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Why dont you use nth-child css selector?
Reply With Quote
  #6  
Old 02-21-2010, 09:26 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by vB Style View Post
Why dont you use nth-child css selector?
Does that work for all browsers? I know some pseudo classes are wonky with some browsers.
Reply With Quote
  #7  
Old 02-21-2010, 09:38 PM
ForumsMods ForumsMods is offline
 
Join Date: Aug 2007
Location: Argentina
Posts: 667
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Does not work with all browser. It works for lastest versions of browser. But not for IE, maybe in IE 9.
Reply With Quote
  #8  
Old 02-21-2010, 11:09 PM
way2xtreme way2xtreme is offline
 
Join Date: Oct 2006
Posts: 104
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Lynne View Post
Try it and see. (You forgot the ones in the top four rows.)
Hi Lynne,

I just put this before threadbit now. I am getting only "alt1" for {vb:raw $post['altclass'] } in every row..

Thanks
WC

Code:
<vb:if condition="!isset($post['altrow'] )">
<vb:if condition="$post['altrow']  = 0"></vb:if>
</vb:if>
<vb:if condition="++$post['altrow']  % 2 == 0">
<vb:if condition="$post['altclass']  = 'alt2'"></vb:if>
<vb:else />
<vb:if condition="$post['altclass'] = 'alt1'"></vb:if>
</vb:if>
Reply With Quote
  #9  
Old 02-21-2010, 11:26 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

For some reason, I thought you were talking about the postbit...argh! $post is not a variable available in the threadbit template. You can try $thread instead of $post. Sorry about that. And, I'm assuming you define alt1 and alt2 somewhere.
Reply With Quote
  #10  
Old 02-22-2010, 12:31 PM
way2xtreme way2xtreme is offline
 
Join Date: Oct 2006
Posts: 104
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Lynne,

Thanks for the help.

I put the following code before threadbit and I am still getting only "alt1" from {vb:raw $thread['altclass'] }...

Anything else I can try?

WC

Code:
<vb:if condition="!isset($thread['altrow'] )">
<vb:if condition="$thread['altrow']  = 0"></vb:if>
</vb:if>
<vb:if condition="++$thread['altrow']  % 2 == 0">
<vb:if condition="$thread['altclass']  = 'alt2'"></vb:if>
<vb:else />
<vb:if condition="$thread['altclass'] = 'alt1'"></vb:if>
</vb:if>
Reply With Quote
Reply


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 10:08 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04346 seconds
  • Memory Usage 2,256KB
  • Queries Executed 11 (?)
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
  • (4)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)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_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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete