Discuz!手机版版块页面主题列表中隔几个主题插入一个广告-网站-万卷论坛

万卷论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 21|回复: 0

[discuz教程] Discuz!手机版版块页面主题列表中隔几个主题插入一个广告

[复制链接]
发表于 2018-1-11 14:40:23 | 显示全部楼层 |阅读模式
Discuz!手机版版块页面主题列表中隔几个主题插入一个广告位的方法,打开模板(以触屏版为例)
\template\default\touch\forum\forumdisplay.htm

将代码
[html] view plain copy print?

  • <!--{loop $_G['forum_threadlist'] $key $thread}-->  
  •     <!--{if !$_G['setting']['mobile']['mobiledisplayorder3'] && $thread['displayorder'] > 0}-->  
  •         {eval continue;}  
  •     <!--{/if}-->  
  •     <!--{if $thread['displayorder'] > 0 && !$displayorder_thread}-->  
  •         {eval $displayorder_thread = 1;}  
  •     <!--{/if}-->  
  •     <!--{if $thread['moved']}-->  
  •         <!--{eval $thread[tid]=$thread[closed];}-->  
  •     <!--{/if}-->  
  •     <li>  
  •     <!--{hook/forumdisplay_thread_mobile $key}-->  
  •     <a href="forum.php?mod=viewthread&tid=$thread[tid]&extra=$extra" $thread[highlight] >  
  •     {$thread[subject]}  
  •     <span class="by">$thread[author]</span>  
  •     </a>  
  •     <span class="num">{$thread[replies]}</span>  
  •     <!--{if in_array($thread['displayorder'], array(1, 2, 3, 4))}-->  
  •         <span class="icon_top"><img src="{STATICURL}image/mobile/images/icon_top.png"></span>  
  •     <!--{elseif $thread['digest'] > 0}-->  
  •         <span class="icon_top"><img src="{STATICURL}image/mobile/images/icon_digest.png"></span>  
  •     <!--{elseif $thread['attachment'] == 2 && $_G['setting']['mobile']['mobilesimpletype'] == 0}-->  
  •         <span class="icon_tu"><img src="{STATICURL}image/mobile/images/icon_tu.png"></span>  
  •     <!--{/if}-->  
  •     </li>  
  • <!--{/if}-->  
  • {eval $index++;}      
  • <!--{/loop}-->  

<!--{loop $_G['forum_threadlist'] $key $thread}-->        <!--{if !$_G['setting']['mobile']['mobiledisplayorder3'] && $thread['displayorder'] > 0}-->                {eval continue;}        <!--{/if}-->        <!--{if $thread['displayorder'] > 0 && !$displayorder_thread}-->                {eval $displayorder_thread = 1;}        <!--{/if}-->        <!--{if $thread['moved']}-->                <!--{eval $thread[tid]=$thread[closed];}-->        <!--{/if}-->        <li>        <!--{hook/forumdisplay_thread_mobile $key}-->        <a href="forum.php?mod=viewthread&tid=$thread[tid]&extra=$extra" $thread[highlight] >        {$thread[subject]}        <span class="by">$thread[author]</span>        </a>        <span class="num">{$thread[replies]}</span>        <!--{if in_array($thread['displayorder'], array(1, 2, 3, 4))}-->                <span class="icon_top"><img src="{STATICURL}image/mobile/images/icon_top.png"></span>        <!--{elseif $thread['digest'] > 0}-->                <span class="icon_top"><img src="{STATICURL}image/mobile/images/icon_digest.png"></span>        <!--{elseif $thread['attachment'] == 2 && $_G['setting']['mobile']['mobilesimpletype'] == 0}-->                <span class="icon_tu"><img src="{STATICURL}image/mobile/images/icon_tu.png"></span>        <!--{/if}-->        </li><!--{/if}-->{eval $index++;}        <!--{/loop}-->
修改为
[html] view plain copy print?

  • {eval $index=0;}  
  • <!--{loop $_G['forum_threadlist'] $key $thread}-->  
  •     <!--{if !$_G['setting']['mobile']['mobiledisplayorder3'] && $thread['displayorder'] > 0}-->  
  •         {eval continue;}  
  •     <!--{/if}-->  
  •     <!--{if $thread['displayorder'] > 0 && !$displayorder_thread}-->  
  •         {eval $displayorder_thread = 1;}  
  •     <!--{/if}-->  
  •     <!--{if $thread['moved']}-->  
  •         <!--{eval $thread[tid]=$thread[closed];}-->  
  •     <!--{/if}-->  
  •     <li>  
  •     <!--{hook/forumdisplay_thread_mobile $key}-->  
  •     <a href="forum.php?mod=viewthread&tid=$thread[tid]&extra=$extra" $thread[highlight] >  
  •     {$thread[subject]}  
  •     <span class="by">$thread[author]</span>  
  •     </a>  
  •     <span class="num">{$thread[replies]}</span>  
  •     <!--{if in_array($thread['displayorder'], array(1, 2, 3, 4))}-->  
  •         <span class="icon_top"><img src="{STATICURL}image/mobile/images/icon_top.png"></span>  
  •     <!--{elseif $thread['digest'] > 0}-->  
  •         <span class="icon_top"><img src="{STATICURL}image/mobile/images/icon_digest.png"></span>  
  •     <!--{elseif $thread['attachment'] == 2 && $_G['setting']['mobile']['mobilesimpletype'] == 0}-->  
  •         <span class="icon_tu"><img src="{STATICURL}image/mobile/images/icon_tu.png"></span>  
  •     <!--{/if}-->  
  •     </li>  
  • <!--{if in_array($index,array(2,6,9))}-->  
  • <li>  
  •   
  • <!--上面一行添加广告代码-->  
  • </li>  
  • <!--{/if}-->  
  • {eval $index++;}      
  • <!--{/loop}-->  

{eval $index=0;}<!--{loop $_G['forum_threadlist'] $key $thread}-->        <!--{if !$_G['setting']['mobile']['mobiledisplayorder3'] && $thread['displayorder'] > 0}-->                {eval continue;}        <!--{/if}-->        <!--{if $thread['displayorder'] > 0 && !$displayorder_thread}-->                {eval $displayorder_thread = 1;}        <!--{/if}-->        <!--{if $thread['moved']}-->                <!--{eval $thread[tid]=$thread[closed];}-->        <!--{/if}-->        <li>        <!--{hook/forumdisplay_thread_mobile $key}-->        <a href="forum.php?mod=viewthread&tid=$thread[tid]&extra=$extra" $thread[highlight] >        {$thread[subject]}        <span class="by">$thread[author]</span>        </a>        <span class="num">{$thread[replies]}</span>        <!--{if in_array($thread['displayorder'], array(1, 2, 3, 4))}-->                <span class="icon_top"><img src="{STATICURL}image/mobile/images/icon_top.png"></span>        <!--{elseif $thread['digest'] > 0}-->                <span class="icon_top"><img src="{STATICURL}image/mobile/images/icon_digest.png"></span>        <!--{elseif $thread['attachment'] == 2 && $_G['setting']['mobile']['mobilesimpletype'] == 0}-->                <span class="icon_tu"><img src="{STATICURL}image/mobile/images/icon_tu.png"></span>        <!--{/if}-->        </li><!--{if in_array($index,array(2,6,9))}--><li><!--上面一行添加广告代码--></li><!--{/if}-->{eval $index++;}        <!--{/loop}-->修改说明
in_array($index,array(2,6,9)表示在第3、第7、第10个主题后面插入一个广告位,广告代码在上面所示位置。

温馨提示:
1、注册不是必须,万卷论坛非会员区都可以浏览阅读。
2、当您在访问万卷论坛中遇到问题,请联系QQ:2328858568 微信:a15319999845给您处理。注明:万卷论坛。 投诉邮箱:673665010@qq.com 第一时间给您回复处理。



上一篇:DISCUZ!论坛管理员无法登录后台的各种解决方法总结
下一篇:Discuz!开发之插件页面title、keywords、description等SEO设置
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|手机版|Archiver|万卷论坛 ( 陕ICP备10200105号-1 )|网站地图

GMT+8, 2018-1-23 02:23 , Processed in 0.064146 second(s), 28 queries , Gzip On.

Powered by 电子书在线阅读 X3.4

© 2001-2017

快速回复 返回顶部 返回列表