<var id="xvh3p"><noframes id="xvh3p"><var id="xvh3p"></var><listing id="xvh3p"><strike id="xvh3p"><listing id="xvh3p"></listing></strike></listing>
<var id="xvh3p"><strike id="xvh3p"><var id="xvh3p"></var></strike></var><th id="xvh3p"><strike id="xvh3p"><th id="xvh3p"></th></strike></th>
<span id="xvh3p"><noframes id="xvh3p"><dl id="xvh3p"></dl>
<span id="xvh3p"><noframes id="xvh3p">
<dl id="xvh3p"><noframes id="xvh3p">
<listing id="xvh3p"><noframes id="xvh3p"><listing id="xvh3p"><strike id="xvh3p"><listing id="xvh3p"></listing></strike></listing><th id="xvh3p"><strike id="xvh3p"><th id="xvh3p"></th></strike></th>
<th id="xvh3p"><strike id="xvh3p"></strike></th>
<dl id="xvh3p"><noframes id="xvh3p">
<th id="xvh3p"><noframes id="xvh3p">

观点

互联网+时代,说建站,谈运营与网络营销

dedecms二次开发时使用{dede:arclist},{dede:list}获取附件字段

时间:2020-12-10

以前用织梦DEDECMS做二次开发时获取附加表字段内容都是通过runphp执行SQL查询获得,最近看了看手册,发现一个非常简便的方法。 

用arclist调用于附加表字段的方法: 

方法一: 

要获取附加表内容,必须符合两个条件 
1、指定 channelid 属性(注意:channelid不是栏目id,而是自定义模型的id!) 
2、指定要获得的从表字段:addfields=’字段1,字段’ 
如: 
1 {dede:arclist addfields=’video_description,video_id’ row=’8′ channelid=’3′}
2 [field:video_description /] – [field:video_id /]
3 {/dede:arclist}


其中addfields=’video_description,video_id’是附加表中的两个字段。除指定的附加表字段外,其它底层字段如arcurl,title,infos等均能正常调用。 

同样,dede:list标签也可调取附加表字段,和arclist不同的是不用指定channelid,因为系统能自动判断。 
调用格式如下: 
{dede:list addfields=’video_description,video_id’ pagesize=’8′} 
[field:video_description /] – [field:video_id /] 
{/dede:list} 

注意:取出的是附加表中所有记录的相应字段。 

方法二: 

DedeCms在dede:arclist标签如何调用附加表内容(其他标签一样适用) 

代码如下: