<article:position name="item" limit="10" pos="4" cate="1,2,3,4,5,6,7"> <li> <a href="{:U('Article/detail', array('id' => $item['id']))}"> <img width="1000" height="443" src="{:get_cover($item['cover_id'], 'path')}" alt="{$item.title}" /> </a> </li> </article:position>該段程式碼取資料的時候最多隻能取兩條,原因
文件模型標籤庫,取推薦位置列表limit引數無效
路徑:ThinkPHP/Library/OT/TagLib/Article.class.php
/* 推薦位列表 */ public function _position($tag, $content){ $pos = $tag['pos']; $cate = $tag['cate']; $limit = empty($tag['limit']) ? 'null' : $tag['limit']; $field = empty($tag['field']) ? 'true' : $tag['field']; $name = $tag['name']; $parse = '<?php '; $parse .= '$__POSLIST__ = D(\'Document\')->position('; $parse .= $pos . ','; $parse .= '\''.$cate . '\',';// 此處加入引號,問題解決 $parse .= $limit . ','; $parse .= $field . ');'; $parse .= ' ?>'; $parse .= '<volist name="__POSLIST__" id="'. $name .'">'; $parse .= $content; $parse .= '</volist>'; return $parse; }