实现DedeCMS搜索结果页显示自定义字段

如果通过“内容模型管理 > 自定义搜索”搜索的结果页如果要显示自定义字段,可使用以下方法: 

1、修改puls/advancedsearch.php文件,找到 


$query = "select arctype.* from $addontable addon 
left join cmsxx_arctype arctype on arctype.id=addon.typeid 
$where $orderby"; 
} else { 
$query = "select main.id as aid,main.*,main.description as description1, type.* 
from $maintable main 
left join cmsxx_arctype type on type.id=main.typeid 
left join $addontable addon on addon.aid=main.id 
$where $orderby"; 

在select后面增加"addon.*," 

修改后应该是

$query = "select <span style="color:#ff0000;">addon.*,</span> arctype.* from $addontable addon 
left join cmsxx_arctype arctype on arctype.id=addon.typeid 
$where $orderby"; 
} else { 
$query = "select <span style="color:#ff0000;">addon.*,</span>main.id as aid,main.*,main.description as description1, type.* 
from $maintable main 
left join cmsxx_arctype type on type.id=main.typeid 
left join $addontable addon on addon.aid=main.id 
$where $orderby"; 

注意,有两个地方要加 

显示结果要修改模板文件,在plus/advancedsearch.htm,{dede:datalist}中直接调用{dede:field.字段名称/} 就好了。



【转自】http://www.veryhuo.com/a/view/9748.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
对于 dedecms 自定义表单,您可以通过以下步骤来自定义表单 html: 1. 登录 dedecms 后台,进入“模板管理”->“自定义模板”,创建一个新的自定义模板。 2. 在自定义模板中添加一个表单元素,可以使用 HTML 标签来创建表单,如下所示: ```html <form action=&quot;submit.php&quot; method=&quot;post&quot;> <label for=&quot;name&quot;>Name:</label> <input type=&quot;text&quot; name=&quot;name&quot; id=&quot;name&quot;> <br> <label for=&quot;email&quot;>Email:</label> <input type=&quot;email&quot; name=&quot;email&quot; id=&quot;email&quot;> <br> <input type=&quot;submit&quot; value=&quot;Submit&quot;> </form> ``` 3. 在自定义模板中添加自定义表单的标签,如下所示: ```html {dede:myform name='form1' formid='1' action='form.php' method='post'} ``` 其中,name 表示表单的名称,formid 表示表单的 ID,action 表示表单提交的地址,method 表示表单提交的方法。 4. 将表单元素添加到自定义表单的标签中,如下所示: ```html {dede:myform name='form1' formid='1' action='form.php' method='post'} <label for=&quot;name&quot;>Name:</label> <input type=&quot;text&quot; name=&quot;name&quot; id=&quot;name&quot;> <br> <label for=&quot;email&quot;>Email:</label> <input type=&quot;email&quot; name=&quot;email&quot; id=&quot;email&quot;> <br> <input type=&quot;submit&quot; value=&quot;Submit&quot;> {/dede:myform} ``` 5. 保存自定义模板,即可在 dedecms 中使用自定义表单。 至于如何用自己的模板来展示自定义表单,可以在自定义模板中添加表单的样式和布局,来美化自定义表单的展示效果。具体的方法可以参考 dedecms 的官方文档或者相关的教程。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值