No announcement yet.

Alternating rows rather than columns

  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    THANK YOU! daemon !

    Not only was that less code and simpler, it did EXACTLY what I needed to do.


    • #17
      I'm wondering if anybody has succeeded in implementing alternating row colours on the search results pages?


      • #18
        Anyone have any ideas why this wouldnt work in the postbit_legacy template??

        I am getting the same color across all backgrounds in every post in both columns and rows..

        Simply trying to alternate row colors..

        The colors are different for alt1 and alt2...


        • #19
          URL? Have you modified the templates?
          Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
          Change CKEditor Colors to Match Style (for 4.1.4 and above)

          Steve Machol Photography

          Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


          • #20
            i reverted the postbit_legacy template back..

            placed the above mentioned code block in and all i got was solid colors across all post rows and columns with no alternating at all..

            I cannot provide a link as the site is currently in development.


            • #21
              Originally posted by Timan
              Just wondering I've tried and tried and tried everything, to get the threadbit rows to alternate colors, I've put the exec_switch_bg() stuff at the top and all, but what exactly is $bgclass, what class is it refering to and what class does it get replaced with, or am I missing something.

              Any help would be appreciated
              Yes, I just tested this and it still works.

              The function exec_switch_bg() tells vBulletin to change the variable $bgclass between 'alt1' and 'alt2' every time it's called.

              Here's the code that I used for my threadbit template:

              HTML Code:
              <if condition="exec_switch_bg()"></if>
              	<td class="$bgclass"><img src="$stylevar[imgdir_statusicon]/thread$thread[statusicon].gif" alt="<if condition="$show['threadcount']"><phrase 1="$thread[dot_count]" 2="$thread[dot_lastpost]">$vbphrase[have_x_posts_in_thread_last_y]</phrase></if>" border="" /></td>
              	<if condition="$show['threadicons']">
              		<td class="$bgclass"><if condition="$show['threadicon']"><img src="$thread[threadiconpath]" alt="$thread[threadicontitle]" border="0" /><else />&nbsp;</if></td>
              	<td class="{$bgclass}Active" id="t$thread[threadid]" title="$thread[preview]">
              			<span style="float:$stylevar[right]">
              				<if condition="$show['paperclip']"><img class="inlineimg" src="$stylevar[imgdir_misc]/paperclip.gif" alt="<phrase 1="$thread[attach]">$vbphrase[x_attachments]</phrase>" /></if>
              				<if condition="$show['subscribed']"><img class="inlineimg" src="$stylevar[imgdir_misc]/subscribed.gif" alt="$vbphrase[you_are_subscribed_to_this_thread]" /></if>
              				<if condition="$show['sticky']"><img class="inlineimg" src="$stylevar[imgdir_misc]/sticky.gif" alt="$vbphrase[sticky_thread]" /></if>
              			<if condition="$show['gotonewpost']"><a href="showthread.php?$session[sessionurl]goto=newpost&amp;t=$thread[threadid]"><img class="inlineimg" src="$stylevar[imgdir_button]/firstnew.gif" alt="$vbphrase[go_to_first_new_post]" border="0" /></a></if>
              			<a href="showthread.php?$session[sessionurl]t=$thread[threadid]$thread[highlight]"><if condition="$show['gotonewpost']"><strong>$thread[threadtitle]</strong><else />$thread[threadtitle]</if></a>
              			<if condition="$thread['pagenav']"><span class="smallfont" style="white-space:nowrap">( <img class="inlineimg" src="$stylevar[imgdir_misc]/multipage.gif" alt="$vbphrase[multipage_thread]" border="0" /> $thread[pagenav] <if condition="$show[pagenavmore]">... <a href="showthread.php?$session[sessionurl]t=$thread[threadid]&amp;goto=lastpost$thread[highlight]">$vbphrase[last_page]</a></if> )</span></if>
              		<div class="smallfont">
              			<if condition="$show['threadratings'] AND $show['threadrating']"><span style="float:$stylevar[right]"><img class="inlineimg" src="$stylevar[imgdir_rating]/rating_$thread[rating].gif" border="0" alt="<phrase 1="$thread[votenum]" 2="$thread[voteavg]">$vbphrase[thread_rating_x_votes_y_average]</phrase>" /></span></if>
              			<if condition="$show['guestuser']">
              			<else />
              				<span style="cursor:pointer" onclick="'member.php?$session[sessionurl]u=$thread[postuserid]')">$thread[postusername]</span>
              		<if condition="$show['unsubscribe']">
              			<div class="smallfont">
              				<a href="newreply.php?$session[sessionurl]do=newreply&amp;t=$thread[threadid]">$vbphrase[reply]</a> |
              				<a href="subscription.php?$session[sessionurl]do=removesubscription&amp;return=ucp&amp;t=$thread[threadid]">$vbphrase[unsubscribe]</a>
              	<if condition="$show['threadmoved']">
              	<td class="$bgclass" align="center">-</td>
              	<else />
              	<td class="$bgclass" title="<phrase 1="$thread[replycount]" 2="$thread[views]">$vbphrase[replies_x_views_y]</phrase>">
              		<div class="smallfont" style="text-align:$stylevar[right]; white-space:nowrap">
              			$thread[lastpostdate] <if condition="!$show['detailedtime']"><span class="time">$thread[lastposttime]</span></if><br />
              			<phrase 1="member.php?find=lastposter&amp;t=$thread[threadid]" 2="$thread[lastposter]">$vbphrase[by_x]</phrase>  <a href="showthread.php?$session[sessionurl]goto=lastpost&amp;t=$thread[threadid]"><img class="inlineimg" src="$stylevar[imgdir_button]/lastpost.gif" alt="$vbphrase[go_to_last_post]" border="0" /></a>
              	<if condition="$show['notificationtype']">
              		<td class="$bgclass"><div class="smallfont">
              			<label for="sub$subscribethread[$threadid]">$thread[notification]</label>
              			<input type="hidden" name="oldemailupdate[$subscribethread[$threadid]]" id="oe_$subscribethread[$threadid]" value="$emailupdate[$threadid]" />
              		<td class="$bgclass"><input type="checkbox" name="deletebox[$subscribethread[$threadid]]" id="sub$subscribethread[$threadid]" value="yes" /></td>
              	<else />
              		<td class="$bgclass" align="center"><if condition="$show['threadmoved']">-<else /><a href="#" onclick="who($thread[threadid]); return false;">$thread[replycount]</a></if></td>
              		<td class="$bgclass" align="center">$thread[views]</td>
              		<if condition="$show['forumlink']">
              			<td class="$bgclass"><a href="forumdisplay.php?$session[sessionurl]f=$thread[forumid]">$thread[forumtitle]</a></td>
              It's the standard threadbit template with only the alternating row colour modification.
              Bugdar: PHP bug tracking software that is beautiful, fast, and robust.


              • #22
                Yea naturally my luck, I fixed it the second I post :P,

                What about adding alternating colors to say the search results?


                • #23
                  Originally posted by Daveh

                  <if condition="$post[postcount] % 2 == 0">class="alt1"<else />class="alt2"</if>
                  This will alternate the colours in the image. I've fiddled with the postbit_legacy template, such as replace the thead with an alt1 or alt2, but you get the idea.
                  This worked perfectly for me, though your original code snippet is missing the closing quote after alt2 - thanks for the tip! (I only used it on the postbit_legacy template though.. didn't need it anywhere else.) It would be nice if the conditional statement could only be executed once in the template and set a variable string that could be then inserted into the appropriate locations throughout the template, but I'm not yet completely familiar with the template processor's capabilities and whether it could handle such variables.


                  widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.