1. 论坛系统升级为Xenforo,欢迎大家测试!
    排除公告

如何在主题的第一帖后面显示一个广告条

本帖由 giggs2007-03-24 发布。版面名称:源码讨论

  1. giggs

    giggs New Member

    注册:
    2007-03-03
    帖子:
    25
    赞:
    0
    管理面板->风格与模版->风格管理->« » 按钮->帖子块模版->postbit 或 postbit_legacy (根据您选择的帖子布局选择)

    在模版最下方的位置添加下面代码中的蓝色部分:

    </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 -->

    <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">赞助商链接</td>
    </tr>
    <tr>
    <td class="alt1" align="center">
    广告条代码放置于此
    </td>
    </tr>
    </table>

    </div>

    </if>



    将上面代码中红色的部分替换为您的广告条代码。

    还有几个变体供您将广告条显示在不同位置。您只需将上面的代码中的“if”部分替换为下述的代码。

    ...在每一页的第一篇帖子后 (而不只是第一页的第一篇帖子):


    <if condition="$post[postcount] % $vboptions[maxposts] == 1">

    ...在第一篇帖子后,但是仅对游客可见:

    <if condition="$post[postcount] == 1 AND !$bbuserinfo[userid]">

    ...在第一篇帖子后,但是仅当该主题有两篇帖子时才显示:

    <if condition="$post[postcount] == 1 AND $GLOBALS[threadinfo][replycount] >= 2">

    ...在第一篇帖子后,但是仅在指定版面显示 (X,Y,Z 是逗号分隔的版面 ID 列表):

    <if condition="$post[postcount] == 1 AND in_array($GLOBALS[forumid], array(X,Y,Z))">

    ...在每 X 篇帖子后 (将 X 替换为一个数字):

    <if condition="$post[postcount] % X == 0">

    ...在每页的最后一帖之后:

    <if condition="$post['islastshown']">

    ...在最后一帖和倒数第二帖之间 (需要将上面的代码从模版的最下方移动到最上方,然后使用与上一条相同的条件):

    <if condition="$post['islastshown']">

    您可以使用上面列出的条件的不同组合。例如。如果您想让广告条现实中每页的第一帖之后 (而不只是第一页的第一帖后),但是只有游客可以看到广告条,并且广告条仅出现在某些版面中 (X,Y,Z 是逗号分隔的版面 ID 列表):

    <if condition="$post[postcount] % $vboptions[maxposts] == 1 AND !$bbuserinfo[userid] AND in_array($GLOBALS[forumid], array(X,Y,Z))">