How To Show A Banner After The First Post In A Thread

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jake Bunce
    Senior Member
    • Dec 2000
    • 46598
    • 3.6.x

    How To Show A Banner After The First Post In A Thread

    The old instructions for version 3.5.x required some changes in 3.6.x. The conditions are the same, but the layout code is different. Here are the new instructions:

    Admin CP -> Styles & Templates -> Style Manager -> « » -> Postbit Templates -> postbit or postbit_legacy (depending on which layout you are using)

    Add the blue code to the very bottom of the template:

    Code:
    	</if>
    	<if condition="$post['userid'] AND $show['member']">
    	<tr><td class="vbmenu_option"><a href="profile.php?$session[sessionurl]do=addlist&amp;userlist=buddy&amp;u=$post[userid]"><phrase 1="$post[username]">$vbphrase[add_x_to_buddy_list]</phrase></a></td></tr>
    	</if>
    	</table>
    </div>
    <!-- / post $post[postid] popup menu -->
    
    [color=blue]<if condition="$post[postcount] == 1">
    
    <div style="padding: $stylevar[cellpadding]px 0px 0px 0px">
    
    <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
    <tr>
    	<td class="thead" align="left">Sponsored Links</td>
    </tr>
    <tr>
    	<td class="alt1" align="center">
    		[color=red]BANNER CODE HERE[/color]
    	</td>
    </tr>
    </table>
    
    </div>
    
    </if>[/color]
    Replace the red code with your own banner / ad code.

    The end result will look like this:

    [ATTACH]12473[/ATTACH]

    Here are several other conditions you can use in the above code to show the banner in different places. Simply replace the first "if" statement.

    ...after the first post on every page (instead of just the first page):

    Code:
    [color=blue]<if condition="$post[postcount] % $vboptions[maxposts] == 1">[/color]
    ...after the first post, but only for guests:

    Code:
    [color=blue]<if condition="$post[postcount] == 1 AND !$bbuserinfo[userid]">[/color]
    ...after the first post, but only if the thread has at least 2 replies (so you never see a banner and only 1 post):

    Code:
    [color=blue]<if condition="$post[postcount] == 1 AND $GLOBALS[threadinfo][replycount] >= 2">[/color]
    ...after the first post, but only in specific forums (where X,Y,Z is a comma list of forumids):

    Code:
    [color=blue]<if condition="$post[postcount] == 1 AND in_array($GLOBALS[forumid], array([color=red]X,Y,Z[/color]))">[/color]
    ...after every X posts (replace X with a number):

    Code:
    [color=blue]<if condition="$post[postcount] % X == 0">[/color]
    ...after the last post on every page:

    Code:
    [color=blue]<if condition="$post['islastshown']">[/color]
    ...between the last and second to last post on every page (need to move the above code to the very top of the template instead of the bottom, then use the same condition as above):

    Code:
    [color=blue]<if condition="$post['islastshown']">[/color]
    You can use pieces of these conditions to do different combinations. For example, this condition will show the banner after the first post on every page (instead of just the first page), but only for guests, and only in certain forums (where X,Y,Z is a comma list of forumids):

    Code:
    [color=blue]<if condition="$post[postcount] % $vboptions[maxposts] == 1 AND !$bbuserinfo[userid] AND in_array($GLOBALS[forumid], array([color=red]X,Y,Z[/color]))">[/color]
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...