v1.6
列表标签
内链导航
属性 | 值 | 描述 |
---|---|---|
name | 默认是ad,定义val | 一般定义val来使用,标签统一使用方法 |
sid | 表ID | 这是广告索引ID |
index | 默认0,必须指定数据 | 列表开始查询的数据 |
limit | 默认0,必须指定数据 | 列表限制多少个数据 |
orderby | 默认aid desc | 可以自定义排序方法,字段必须是表中的数据字段 |
keywords | 需要指定关键字才能执行相关功能 | 查询关键词的列表数据 |
pagesize | 一般指定10条查询数据 | 指定这个参数可以在标签底部,写入分页代码"{$page|raw}" |
sub | 设置参数为1, | 如果需要查询子栏目数据,需要指定这个值 |
attr | 参数有:b,head,special,top,reco,jump,liptpic,sale,mood,tpl | 属性查询,多个属性可以用逗号隔开 , |
mpic | 默认0, | 无 |
fieldvalue | aid,1;b,1 | 查询指定字段的值,可以查询多个字段的值 |
fieldvaluerm | a.aid:1,2;is_top:1 | 查询移除指定字段的值,可以查询多个字段的值 |
sokws | 默认值:kws | 这里获取链接中的关键字 |
solike | 默认0,不使用模糊查询 | 如果想使用模糊查询,设置参数为1 |
sofield | "title & stock" | “title”表示字段,"&"表示and, "|"表示or,连接之前必须有空格才能正确执行 |
model | 默认-1,默认是需要查 | model模型是否需要查, |
userid | 默认-1,不执行用户编号 | 用于查询发布者的文档集合 |
csql | 原生的SQL语句 | 参数变量可以重链接中获取 |
列表分页,并提供分页总数
<div class="about-info">
{oy:list sid="14" keywords="$kws" pagesize="2" name="val"}
<div class="product-info">
<div class="product-info-img">
<img src="{$val.litpic}123" alt="{$val.title}" />
</div>
<div class="product-info-desc">
<div>
<a href="#"><h2>{$val.title}</h2></a>
<div class="product-info-desc-price"><b>¥{$val.price_seller}</b> 定价:<span>¥{$val.price}</span></div>
<div class="product-info-desc-tag"><span>小程序</span></div>
<div class="product-info-desc-cont">{$val.description}</div>
</div>
<div class="product-info-desc-btn">
<!-- <div><a class="btn-base btn-buy" href="#">立即购买</a></div>
<div><a class="btn-base btn-detail" href="#">查看详情</a></div> -->
<a href="#23"><div class="btn-base btn-buy">立即购买</div></a>
<a href="{$val.url}"><div class="btn-base btn-detail">查看详情</div></a>
</div>
<!-- <a href="#"><h2>这是标内容</h2></a>
<div class="product-info-desc-price"><b>¥3299</b> 定价:<span>¥5299</span></div>
<div>小程序</div> -->
</div>
</div>
{/oy:list}
<div>{$page|raw}</div>
<div>搜索总数:{$total}</div>
列表查询,并查询当前栏目及其子栏目的所有数据
<div class="about-info">
{oy:list sid="$sid" sub="1" pagesize="2" name="val"}
<li>
<img src="{$val.litpic}" style="width:100px;" />
<a href="{$val.url}">{$val.title}-----123123123</a>
</li>
{/oy:list}
<div>{$page|raw}</div>
列表查询,url链接上的参数查询
{oy:list sid="$sid" sofield="title & stock" solike="1" sokws="kws" pagesize="2" name="val"}
<div class="product-info">
<div class="product-info-img">
<img src="{$val.litpic}" alt="title" />
</div>
<div class="product-info-desc">
<div>
<a href="#"><h2>{$val.title}</h2></a>
<div class="product-info-desc-price"><b>¥{$val.price_seller}</b> 定价:<span>¥{$val.price}</span></div>
<div class="product-info-desc-tag"><span>小程序</span></div>
<div class="product-info-desc-cont">{$val.description}</div>
</div>
<div class="product-info-desc-btn">
<!-- <div><a class="btn-base btn-buy" href="#">立即购买</a></div>
<div><a class="btn-base btn-detail" href="#">查看详情</a></div> -->
<a href="#23"><div class="btn-base btn-buy">立即购买</div></a>
<a href="{$val.url}"><div class="btn-base btn-detail">查看详情</div></a>
</div>
<!-- <a href="#"><h2>这是标内容</h2></a>
<div class="product-info-desc-price"><b>¥3299</b> 定价:<span>¥5299</span></div>
<div>小程序</div> -->
</div>
</div>
{/oy:list}
<div class="about-infos">
<div>{$page|raw}</div>
<div>{$getpa|raw}</div>
</div>
列表查询,指定多个sid
{oy:list sid="8,9" keywords="网站" pagesize="2" name="val"}
<li>
<img src="{$val.litpic}" style="width:100px;" />
<a href="{$val.url}">{$val.title}</a>
</li>
{/oy:list}
<div>{$page|raw}</div>
列表查询,指定多个固定参数
{oy:list sid="$sid" fieldvalue="type:建材;mothed:自选" pagesize="2" name="val"}
<li>
<img src="{$val.litpic}" style="width:100px;" />
<a href="{$val.url}">{$val.title}</a>
</li>
{/oy:list}
<div>{$page|raw}</div>
{oy:list sid="$sid" sub="1" fieldvalue="servicesystem:单次" name="val"}
<div><a href="{$val.url}">{$val.title}</a></div>
{/oy:list}
列表查询,指定排序并指定固定参数查询
{oy:list sid="4" limit="4" orderby="aid asc" fieldvalue="link,k2AyBvzywSGC" name="val"}
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-3 col-xl-3">
<div class="tm-content-box">
<img src="__STATIC__/skin/img/tm-img-310x180-1.jpg" alt="Image" class="tm-margin-b-20 img-fluid">
<h4 class="tm-margin-b-20 tm-gold-text">{$val.title}</h4>
<p class="tm-margin-b-20">{$val.description}</p>
<a href="{$val.url}" class="tm-btn text-uppercase">Detail</a>
</div>
</div>
{/oy:list}
列表查询,可以同时搜索,指定查询对应用字段
<div>
{oy:list sid="1" keywords="$kws" sofield="lanmu & leibie" pagesize="1" orderby="aid asc" name="val"}
<div class="media tm-related-post">
<div class="media-left media-middle">
<a href="{$val.url}">
<img class="media-object" style="width:240px; height:120px;" src="{$val.litpic|un_strtoarr=1}" alt="{$val.title}">
</a>
</div>
<div class="media-body">
<!-- <if $val['litpic'] !='' > value1
<elseif $val['litpic'] == 2 />value2
<else /> value3
</if> -->
{if count(un_strtoarr($val['litpic'])) == 1 && !empty(un_strtoarr($val['litpic'])[0]) }1图
{elseif count(un_strtoarr($val['litpic'])) >= 3} 3图
{else /} 无图
{/if}
<a href="{$val.url}"><h4 class="media-heading tm-gold-text tm-margin-b-15">{$val.title}</h4></a>
<p class="tm-small-font tm-media-description">{$val.description|un_strlen=22}</p>
</div>
</div>
{/oy:list}
</div>
<div class="pager">
{$page|raw}
</div>
单内容关联用法contid
<h4 class="small-title">扩展阅读{$uanzlu.aid}</h4>
<div class="row">
{oy:list sid="$sid" fieldvalue="contid:$uanzlu[contid]" limit="10" orderby="aid desc" name="val"}
<li>
<a href="{$val.url}">{$val.title}</a>
</li>
{/oy:list}
</div>
<h4 class="small-title">获取所有的文章的关联数据{$uanzlu.aid}</h4>
<div class="row">
{oy:list sid="$sid" fieldvalue="contid:$uanzlu[aid]]" limit="10" orderby="aid desc" name="val"}
<li>
<a href="{$val.url}">{$val.title}</a>
</li>
{/oy:list}
</div>
多内容关联用法contids
<h4 class="small-title">扩展阅读{$uanzlu.aid}</h4>
<div class="row">
{oy:list sid="$sid" fieldvalue="a.aid:$uanzlu[contids]" limit="10" orderby="aid desc" name="val"}
<li>
<a href="{$val.url}">{$val.title}</a>
</li>
{/oy:list}
</div>
通过模板获取服务器信息,进行判断,可用于导航判断
{assign name="varactive" value="$Think.server.path_info" /}
<div class="collapse show" id="customize-collapse-{$val.link}">
<ul class="list-unstyled fw-normal pb-1 small">
<li><a href="{$val.url}" class="d-inline-flex align-items-center rounded {if $varactive == $val.url}active{/if}" aria-current="page">{$val.title}</a></li>
{oy:list sid="$sid" fieldvalue="a.aid:$val[contids]" limit="20" orderby="aid desc" name="valcont"}
<li><a href="{$valcont.url}" class="d-inline-flex align-items-center rounded {if $varactive == $valcont.url}active{/if}" aria-current="page">{$valcont.title}</a></li>
{/oy:list}
</ul>
</div>
移除指定条件的数据信息
{oy:list sid="$sid" sub="1" pagesize="10" fieldvaluerm="a.aid:3" orderby="aid asc" name="val"}
{/oy:list}
使用原生SQL语句查询数据
{oy:list sid="$sid" sub="1" keywords="$kws" sofield="province" csql="unix_timestamp(#lease#) > unix_timestamp(prostarttime) and unix_timestamp(proendtime) > unix_timestamp(#lease#);lease" pagesize="1" name="val"}
<div class="rental-item">
<div class="rental-item__media"> <img src="{$val.litpic|un_strtoarr=1}" alt="{$val.title}">
<div class="rental-item__links">
{oy:sublist id="$val[sub_id]" type="child" pagesize="1" name="valsub"}
<a href="{$valsub.url}">{$valsub.title}</a>
{/oy:sublist}
<a href="#">报价</a></div>
</div>
{/oy:list}
注意:#lease#是需要替换的数据,“;”需要添加相关的变量,才能获取到数据