phpcms v9 如何用PC标签在列表页中同时调出文章内容

phpcms v9 如何用PC标签在列表页中同时调出文章内容

(2013-05-21 06:54:38)

如何用PC标签在列表页中调出文章内容

phpcms v9 moreinfo=”"参数说明

{pc:content action="lists" catid="$catid" num="15" order="id DESC" page="$page" moreinfo="1"}

参数名是否必须默认值说明:
catid否null调用栏目ID
thumb否0是否仅必须缩略图
order否null排序类型
num是null数据调用数量
moreinfo否0是否调用副表数据。

举个例子
对于文章储层而言,有v9_news和v9_news_data两个表,前面就是主表,后面是副表。如果需要调用文章内容,则这个字段是在v9_news_data 的content字段,在列表页是不能直接调用的,
然后添加 moreinfo="1"等于是结合两个表的字段,这样{$r['content']}就可以在pc:content action="lists"调用出数据了。
{pc:content action="lists" moreinfo="1" catid="$catid" num="25" order="id DESC" page="$page"}
{loop $data $r}
<div class="w680" id="{$n}">
<div {if $n%2==1}class="bj_06"{/if}{if $n%2==0}class="bj_07"{/if}>

<img src="{$r[thumb]}" />
<br />
{$r[content]}

</div>
</div>
{/loop}
{$pages}
{/pc}

moreinfo="1"

在标签中加上
moreinfo="1" 为0不调用副表
官方是这样描述的
提醒:从PHPCMS
V9 Beta
20101105 版本开始支持moreinfo参数属性,本参数表示在返回数据的时候,会把副表中的数据也一起返回。一个内容模型分为2个表,一个主表一个副表,主表中一 般是保存了标题、所属栏目等等短小的数据(方便

原文地址:https://www.cnblogs.com/gzmg/p/3469312.html