织梦dedecms获得某篇文章内容的几种方法,在这里给大家总结了以下三种方法:
1. 使用SQL
{dede:sql sql='Select body from `dede_addonarticle` where aid=146'}
[field:body/]
{/dede:sql}
2.使用arclist, 用idlist获取,aid 是没用的,在首页记得要获取typeid, 用addfields='body'来直接使用[field:body/]
{dede:arclist typeid='49' idlist='146' addfields='body' channelid='1' }
<section class="recommend">
<header class="header">
<h2><a href="[field:arcurl/]">[field:title/]</a></h2>
<a href="[field:arcurl/]" class="more" title="更多...">more</a>
</header>
<div class="content">
[field:body/]
</div>
</section>
{/dede:arclist}
3.混搭
{dede:arclist typeid='48' limit='0,10'}
<li><time class="date">[field:id runphp='yes']
$aid = @me;
$row = $GLOBALS['dsql']->GetOne("Select activitydate From `dede_addonarticle20` where aid='$aid' ");
@me = "{$row['activitydate']}";
[/field:id]</time><a href="[field:arcurl/]" title="查看详情">[field:title/]</a></li>
{/dede:arclist}
(责任编辑:好模板) |