PHPCMS如何调用后台的勾选的“首页焦点图推荐”?最近刚开始上手,折腾了半个小时,终于完全弄明白,特此笔记,高手可以绕行了。
指定推荐位ID(1为首页焦点图)
指定排序类型
推荐位缩略图(1为是)
数据调用数量
=
核心代码
1 |
{pc:content action= "position" posid= "1" order= "listorder DESC" thumb= "1" num= "5" } |
代码注释
推荐位
1 |
action= "position" |
1 |
posid= "1" |
1 |
order= "listorder DESC" |
1 |
thumb= "1" |
1 |
num= "5" |
完整示例
1
2
3
4
5
6 |
{pc:content action= "position" posid= "1" order= "listorder DESC" thumb= "1" num= "5" } <ul> {loop $data $v } <li><a href= "{$v[url]}" ><img src= "{thumb($v[thumb],400,0)}" alt= "{$v[title]}" /></a><br> <p class = "title" ><a href= "{$v[url]}" >< { $CATEGORYS [ $v [ 'catid' ]][ 'catname' ]} ></a></p></li> {/loop} |
备注
1 |
{ $v [url]} |
1 |
{ $CATEGORYS [ $v [ 'catid' ]][ 'url' ]} |
发表评论 取消回复