原文来自:https://www.zixuephp.com
dedecms:datalist搜索页如何调用后台自定义字段内容
解决…修改advancedsearch.php文件找到如下代码:
- $query="selectarctype.*from$addontableaddon
- leftjoindetest_arctypearctypeonarctype.id=addon.typeid
- $where$orderby";
- }else{
- $query="selectmain.idasaid,main.*,main.descriptionasdescription1,type.*
- from$maintablemain
- leftjoindetest_arctypetypeontype.id=main.typeid
- leftjoin$addontableaddononaddon.aid=main.id
- $where$orderby";
在select后面增加"addon.*,",修改后应该是如下代码:
- $query="selectaddon.*,arctype.*from$addontableaddon
- leftjoindetest_arctypearctypeonarctype.id=addon.typeid
- $where$orderby";
- }else{
- $query="selectaddon.*,main.idasaid,main.*,main.descriptionasdescription1,type.*
- from$maintablemain
- leftjoindetest_arctypetypeontype.id=main.typeid
- leftjoin$addontableaddononaddon.aid=main.id
- $where$orderby";
注意,有两个地方要加,显示结果要修改模板文件,在plus/advancedsearch.htm,{dede:datalist}中直接调用{dede:field.字段名称/}就OK了.