优化标签,增加模型标签的使用demo
This commit is contained in:
@@ -37,7 +37,7 @@ class Sent extends \think\template\TagLib {
|
||||
|
||||
public function tagdoc($tag, $content){
|
||||
$model = !empty($tag['model']) ? $tag['model']:'';
|
||||
$cid = isset($tag['cid']) ? (int) $tag['cid'] : 20;
|
||||
$cid = isset($tag['cid']) ? (int) $tag['cid'] : 0;
|
||||
$field = empty($tag['field']) ? '*' : $tag['field'];
|
||||
$limit = isset($tag['limit']) ? (int) $tag['limit'] : 20;
|
||||
$order = empty($tag['order']) ? 'id desc' : $tag['order'];
|
||||
@@ -45,7 +45,7 @@ class Sent extends \think\template\TagLib {
|
||||
|
||||
$parse = $parse = '<?php ';
|
||||
$parse .= '$__LIST__ = \\app\\model\\Document::getDocumentList("'.$model.'", '.$cid.', '.$limit.', "'.$order.'", "'.$field.'");';
|
||||
$parse .= 'foreach ($__LIST__ as $key => $'.$tag['name'].') {';
|
||||
$parse .= 'foreach ($__LIST__ as $key => $'.$name.') {';
|
||||
$parse .= '?>';
|
||||
$parse .= $content;
|
||||
$parse .= '<?php } ?>';
|
||||
|
||||
@@ -30,6 +30,9 @@ html, body {background-color: #fff; color: #636b6f; font-family: 'Raleway', sans
|
||||
{sent:nav tree="false" type="1" name="item"}
|
||||
<li><a href="{$item['url']}">{$item['title']}</a></li>
|
||||
{/sent:nav}
|
||||
{sent:doc model="article" limit="10" cid="1"}
|
||||
<li><a href="{:url('/article/detail-'.$item['id'])}">{$item['title']}</a></li>
|
||||
{/sent:doc}
|
||||
<div class="flex-center position-ref full-height">
|
||||
<div class="content">
|
||||
<div class="title m-b-md">
|
||||
|
||||
Reference in New Issue
Block a user