destoon 内容页批量调用所有自定义字段的方法

来源: https://destoon.cc/ 日期: 2019-03-01 19:55:50 人气: - 评论: 0

destoon 内容页批量调用所有自定义字段的方法

一个一个的在模板里调,是不是太麻烦了,下面的方法就是批量循环出当前频道所有不为空的自定义字段内容。

a $tags = array();
while($r = $db->fetch_array($result)){
$tags[] = $r;
}
return $tags;

}


在内容页中使用 


{php $atts = getfileds('mall');}
 {loop $atts $i $v}
{if $$v[name]}<li>{$v[title]}:{$$v[name]}</li>{/if}
{/loop}


注意:其中 getfileds('mall')  中的mall 是当前频道的表名,商城是 mall  供应 sell_5 求购 buy_6  更我表名请到后台数据库备份那里查看,这里不需要传表前缀。