vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Please help: making alternating row background color in threadbit? (https://vborg.vbsupport.ru/showthread.php?t=236441)

way2xtreme 02-20-2010 11:46 PM

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}


Lynne 02-21-2010 02:39 AM

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'] ?)

way2xtreme 02-21-2010 07:30 PM

Quote:

Originally Posted by Lynne (Post 1987773)
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'] } "


Lynne 02-21-2010 07:58 PM

Try it and see. (You forgot the ones in the top four rows.)

ForumsMods 02-21-2010 08:07 PM

Why dont you use nth-child css selector?

Lynne 02-21-2010 09:26 PM

Quote:

Originally Posted by vB Style (Post 1988323)
Why dont you use nth-child css selector?

Does that work for all browsers? I know some pseudo classes are wonky with some browsers.

ForumsMods 02-21-2010 09:38 PM

Does not work with all browser. It works for lastest versions of browser. But not for IE, maybe in IE 9.

way2xtreme 02-21-2010 11:09 PM

Quote:

Originally Posted by Lynne (Post 1988319)
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>


Lynne 02-21-2010 11:26 PM

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.

way2xtreme 02-22-2010 12:31 PM

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>


Lynne 02-22-2010 10:05 PM

Have you tried printing out the variables so you can see what is going on?

way2xtreme 02-23-2010 01:30 PM

hmm, how do I do that ;)
(My skill is limited)

Lynne 02-23-2010 02:00 PM

{vb:raw thread.altrow} and {vb:raw thread.altclass}

way2xtreme 02-23-2010 10:31 PM

Hi Lynne,

I put the following before Each thread title

Code:

1, {vb:raw $post['altclass'] } 2, {vb:raw thread.altrow} 3, {vb:raw thread.altclass}
and got the following for each row in the list (all same):
Code:

1, alt1 2, 3,
I think we are not getting anything for {vb:raw thread.altrow} and {vb:raw thread.altclass}


Thanks :)

forumthemes 02-24-2010 04:47 AM

Hey,

I ran into the same problem with the release of vBulletin 4 and after seeing this post I decided to figure out how to get this to work as I used it quite heavily in developing skins for vBulletin 3.x.

I have tested the code I came up with and works perfect in vBulletin 4. I have now posted a new helpful tip and trick document on my support forums for all of you to be able to use.

Alternating Row Color for vBulletin 4 Skins [NON-Plugin Method]

way2xtreme 02-24-2010 04:33 PM

Thank you very much. It seems to work now! Hope you will build a vb4 skin soon (and keep me posted)

Also thanks to Lynne again!

forumthemes 02-24-2010 05:11 PM

Your very welcome :) New skins will start coming out I hope by this weekend, I wanted to cleanup a lot of the code to make things cleaner and a touch more like vb3 so i can convert all skins :)


All times are GMT. The time now is 05:20 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.02097 seconds
  • Memory Usage 1,753KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (17)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete