Announcement

Collapse
No announcement yet.

Alternating colors in threadbit template.

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

  • DeSantes
    replied
    Thanks Wayne. Actually, I got an error using your code. I tried the following instead,

    Code:
    <if condition="exec_switch_bg()"></if>
    and it seems to be working perfectly. I appreciate your time.

    Leave a comment:


  • Wayne Luke
    replied
    Put the following in your threadbit template and ignore the above:

    HTML Code:
     <if condition="exec_bg_switch()"></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>

    Leave a comment:


  • DeSantes
    replied
    Originally posted by daemon
    If you have written your own file, right before you eval() your templates out, use exec_switch_bg() (you must require this file from ./includes/functions.php)

    Then, in your template, put class="$bgclass" and it should work

    Else, just try putting class="$bgclass"
    Ok daemon, this one flew right by me.

    So you're saying to abandon the above code in my first post completely?

    Firstly, how do you require the exec_switch_bg() in functions.php?

    I searched through the functions.php and is exec_switch_bg() a function we're calling?

    Is there any code needed in between the parentheses?

    Leave a comment:


  • daemon
    replied
    If you have written your own file, right before you eval() your templates out, use exec_switch_bg() (you must require this file from ./includes/functions.php)

    Then, in your template, put class="$bgclass" and it should work

    Else, just try putting class="$bgclass"

    Leave a comment:


  • DeSantes
    started a topic Alternating colors in threadbit template.

    Alternating colors in threadbit template.

    Hello. I would like to alternate the row colors in my threadbit template.

    I found some code through the search which alternates the row color in the forumhome templates.

    Code:
    <tr align="center" <if condition="$forum['displayorder'] % 2 == 0">class="alt2"<else />class="alt1"</if>>
    I thought I could replace 'displayorder' with 'threadid' but this didn't quite work becuase posts aren't always in the even/odd order due to forum actions like sticky, moving, deleting, etc...

    Is there any other identifier I can use in the above code to alternate row colors for the threadbit template?
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...
X