内容模型管理 > 自定义搜索管理(点击那个你想要自定义搜索的内容模型旁边的那个放大镜的小图标)
然后勾选要搜索的字段,生成下面的代码加入到自己的搜索框即可。
搜索结果页的模板是advancedsearch.htm,第一步是要修改advancedsearch.php,指向自己那个模板目录,这个不难。
但是在搜索结果页中,自定义的字段需要调用出来就还是需要回到advancedsearch.php修改。
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 addon.*, arctype.* from $addontable addon
left join cmsxx_arctype arctype on arctype.id=addon.typeid
$where $orderby";
} else {
$query = "select addon.*,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";
特别注意是dede5.7版本,上面的addon.*,已经存在,但是下面的要自己添加,这样结果页才能用{dede:datalist}中直接调用{dede:field.字段名称/} !!!
如果要做双语站,在自己的模板文件夹下建立多一个advancedsearch_en.htm之外,还要在做多一个plus/advancedsearch_en.php,而且这个要修改,注释掉原来的
if(file_exists(DEDEROOT."/templets/seka/$template"))
{
$templatefile = DEDEROOT."/templets/seka/$template";
}
else
{
$templatefile = DEDEROOT."/templets/seka/advancedsearch_en.htm";
}
在下面加入一句
$templatefile = DEDEROOT."/templets/seka/advancedsearch_en.htm";
直接调用而不用判断,否则会用回原来的那个中文版的advancedsearch.htm