Announcement

Collapse
No announcement yet.

Alternating rows rather than columns

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Alternating rows rather than columns

    Is it possible to get rows to alternate colors in forum home and show thread rather than having columns alternate?

    I've searched all the sister sites but I didn't find anything.

  • #2
    Alternating rows would actually require modifying the files. For help with this I recommend you post on www.vbulletin.org , the official vB hacking site.

    Comment


    • #3
      Interesting.. it can be done withthe Forum home level 2 post template.. but not in the forum display for the thread views? Okay.. I'll continue to look. Thanks Jake.

      Comment


      • #4
        If you want something like the attached image for Showthread its prettty simple. In postbit and/or postbit_legacy you want to change all instances of
        <td class="alt2"
        and
        <td class="alt1"
        to
        <td <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.

        Apologies if this breaks any rules
        Attached Files

        Comment


        • #5
          http://www.vbulletin.com/forum/showthread.php?t=100759 try this

          Comment


          • #6
            Zachery, I appreciate your time, but I've posted this in three places (all the sister sites) and each time you've given me information that isn't what I'm looking for. I've installed that. It alternates items on the forum home.. not in the forum display. Vbulletin.org had a hack for altering ForumDisplay but it doesn't work in vb3.0.1. I'm interested in alternating thread rows in Forumdisplay.

            Daveh,
            Thanks. I'll hang onto that in case I do want to do postbits too. Right now I really just want the thread listings to alternate.

            Comment


            • #7
              You would need to do about the same for forumdisplay templates. just replacing it where applicable, you dont need to hack.

              Comment


              • #8
                Thanks. I tried that. The if statements dont' work. I think it's becuase they contain $forum[description] and I can't figure out the proper phrase for threads. I've tried $thread and even $show but nothing seems to actually work in forum display.

                Comment


                • #9
                  to use it in the forumdisplay use $foruminfo[forumid]

                  Comment


                  • #10
                    Thanks.

                    I tried
                    Code:
                    <if condition="$foruminfo['forumid'] % 2 == 0">class="alt2"<else />class="alt1"</if>
                    for the if statement I still get no change in ForumDisplay.

                    Comment


                    • #11
                      Dont use single quotes in if conditions

                      Comment


                      • #12
                        The original if stament looked like this:
                        Code:
                        <if condition="$forum['displayorder'] % 2 == 0">class="alt2"<else />class="alt1"</if>
                        It contains single quotes.

                        I've tried
                        Code:
                        <if condition="$foruminfo[forumid] % 2 == 0">class="alt2"<else />class="alt1"</if>
                        with and without single quotes, I get no change.

                        Sorry to be so frustrating about this.

                        Comment


                        • #13
                          I'm having the same problem. No matter what I try I can't get the rows to alternate as opposed to the columns! HELP!

                          Comment


                          • #14
                            Okay I got closer. By adding the if statement using $thread[threadid] in the threadbits template I got alternating rows. However, the colors are assigned by thread ID so they dont' alternate properly. If someone posts to a thread, it moves up in the list, but retains it's originally assigned class.

                            So.. with this...

                            Code:
                            <if condition="$thread[threadid] % 2 == 0">class="alt2"<else />class="alt1"</if>
                            can anyone help me make that statement conditional on the display order of the thread rather than the thread ID? I did try $thread['displayorder'] but that didnt' work at all.

                            Thanks.

                            Comment


                            • #15
                              I think that this will still work:
                              HTML Code:
                               <if condition="exec_switch_bg()"></if>
                               <tr class="$bgclass">
                               	<td><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><if condition="$show['threadicon']"><img src="$thread[threadiconpath]" alt="$thread[threadicontitle]" border="0" /><else />&nbsp;</if></td>
                               	</if>
                               	<td id="t$thread[threadid]" title="$thread[preview]">
                               		<div>
                               			<span style="float:$stylevar[right]">
                               		    	<if condition="$show['paperclip']"><img src="$stylevar[imgdir_misc]/paperclip.gif" alt="<phrase 1="$thread[attach]">$vbphrase[x_attachments]</phrase>" /></if>
                               		    	<if condition="$show['subscribed']"><img src="$stylevar[imgdir_misc]/subscribed.gif" alt="$vbphrase[you_are_subscribed_to_this_thread]" /></if>
                               		    	<if condition="$show['sticky']"><img src="$stylevar[imgdir_misc]/sticky.gif" alt="$vbphrase[sticky_thread]" /></if>
                               			</span>
                               			<if condition="$show['gotonewpost']"><a href="showthread.php?$session[sessionurl]goto=newpost&amp;t=$thread[threadid]"><img src="$stylevar[imgdir_button]/firstnew.gif" alt="$vbphrase[go_to_first_new_post]" border="0" /></a></if>
                               			$thread[movedprefix]
                               			$thread[typeprefix]
                               			<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 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">$vbphrase[last_page]</a></if> )</span></if>
                               		</div>
                               		<div class="smallfont">
                               			<if condition="$show['threadratings'] AND $show['threadrating']"><span style="float:$stylevar[right]"><img 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']">
                               				Started by: $thread[postusername]
                               			<else />
                               		    	Started by: <span style="cursor:hand" onclick="window.open('member.php?$session[sessionurl]u=$thread[postuserid]')">$thread[postusername]</span>
                               			</if>
                               		</div>
                               		<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>
                               			</div>
                               		</if>
                               	</td>
                               	<td 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 src="$stylevar[imgdir_button]/lastpost.gif" alt="$vbphrase[go_to_last_post]" border="0" /></a>
                               		</div>
                               	</td>
                               	<if condition="$show['notificationtype']">
                               		<td><div class="smallfont" align="$stylevar[right]">
                               			<label for="sub$subscribethread[$threadid]">$thread[notification]<input type="checkbox" name="deletebox[$subscribethread[$threadid]]" id="sub$subscribethread[$threadid]" value="yes" /></label>
                               			<input type="hidden" name="oldemailupdate[$subscribethread[$threadid]]" id="oe_$subscribethread[$threadid]" value="$emailupdate[$threadid]" />
                               		</div></td>
                               	<else />
                               		<td align="center"><a href="#" onclick="who($thread[threadid])">$thread[replycount]</a></td>
                               		<td align="center">$thread[views]</td>
                               			
                               		<if condition="$show['forumlink']">
                               		    <td><a href="forumdisplay.php?$session[sessionurl]f=$thread[forumid]">$thread[forumtitle]</a></td>
                               		</if>
                               	</if>
                               </tr>
                              If not, the general gist is to:

                              - Put the conditional: <if condition="exec_switch_bg()"></if> at the top of the template you want alternation in
                              - Use $bgclass for all of the classes that you want alternated

                              Example:

                              HTML Code:
                              <if condition="exec_switch_bg()"></if>
                              
                              <tr class="$bgclass">
                                 <td valign="top">I like to type meaningless HTML in my posts!</td>
                                 <td>Blah!</td>
                              </tr>
                              Bugdar: PHP bug tracking software that is beautiful, fast, and robust.

                              Comment

                              Loading...
                              Working...
                              X