phpcms 替换超过五条数据时的取法
在 标题 关键词 来源 摘要 内容 中 可同时填入两条数据 用 | 隔开
如图:
{pc:content action="lists" catid="67" order="id ASC" num="2" moreinfo="1"} {loop $data $key $val} <div class="blog-post"> <h4><a href="single.html">{php $title = explode('|', $val[title])} {$title[0]}</a></h4> <div class="post-details"> <p>{php $keywords = explode('|', $val[keywords])} {$keywords[0]} <a href="#">{php $keywords = explode('|', $val[keywords])} {$keywords[1]}</a> {php list($copyfrom) = explode('|', $val['copyfrom'])} {$copyfrom} <a href="#">{php $description = explode('|', $val[description])} {$description[0]}</a> {php $description = explode('|', $val[description])} {$description[1]} </p> </div> <a href="single.html"><img src="{$val[thumb]}" alt="" /></a> <p>{php $content = explode('|', $val[content])} {$content[0]}</p> <p>{php $content = explode('|', $val[content])} {$content[1]}</p> <a class="hvr-shutter-in-vertical button more" href="{$val[url]}">{php $title = explode('|', $val[title])} {$title[1]}</a> </div> {/loop} {/pc}
用explode 分割取索引 就好了