<var id="xvh3p"><noframes id="xvh3p"><var id="xvh3p"></var><listing id="xvh3p"><strike id="xvh3p"><listing id="xvh3p"></listing></strike></listing>
<var id="xvh3p"><strike id="xvh3p"><var id="xvh3p"></var></strike></var><th id="xvh3p"><strike id="xvh3p"><th id="xvh3p"></th></strike></th>
<span id="xvh3p"><noframes id="xvh3p"><dl id="xvh3p"></dl>
<span id="xvh3p"><noframes id="xvh3p">
<dl id="xvh3p"><noframes id="xvh3p">
<listing id="xvh3p"><noframes id="xvh3p"><listing id="xvh3p"><strike id="xvh3p"><listing id="xvh3p"></listing></strike></listing><th id="xvh3p"><strike id="xvh3p"><th id="xvh3p"></th></strike></th>
<th id="xvh3p"><strike id="xvh3p"></strike></th>
<dl id="xvh3p"><noframes id="xvh3p">
<th id="xvh3p"><noframes id="xvh3p">

观点

互联网+时代,说建站,谈运营与网络营销

如何实现在列表页中间随机插入广告

时间:2020-12-16

DEDECMS织梦列表页每隔N行文章添加一条广告(也可以自定义改为虚线、实线等),代码如下:

{dede:arclist row=30 titlelen=50 orderby=pubdate}
<li><span>[field:stime/]</span><a href="[field:arcurl/]" target="_blank">[field:title/]</a>
[field:global.autoindex runphp='yes']
if(@me%5==0){
@me="<div></div>";
}
else{
@me="";
}
[/field:global.autoindex]
</li>
{/dede:arclist}

代码解释

[field:global.autoindex/] 这个就是循环变量,表示当前是第几条循环后输出的结果

(@me % 5) = 0 判断当前值是否是5的倍数

@= '<div></div>';这个中间的<div></div> 就是如果是5的倍数后所要显示的具体Html代码。如果想把广告换成每5条信息后添加一条虚线,也可以把红色的<div></div>写成<div class="liebiao_line"></div>,其css可以写成如下样式:

<style type="text/css">
.liebiao_line{ height:1px; width:100%; border-bottom:1px dashed #000;}
</style>

0
首页
案例
关于
联系