本人也是职场小白,最近学织梦者dedecms给公司官网建站的时候摸到了一点门路,在dede上面下载了模板,发现搜索引擎这一块并没有做到搜索页面内容不存在的交互显示,为了使用户体验更加好,需要在最底层代码里面加行代码即可,路径在本地的www工程里面找到include文件夹下面的arc.searchview.class.php ,找到搜索引擎的那串排序方式,在后面写个jq如截图
实现代码如下
$this->dsql->SetQuery($query); $this->dsql->Execute("al"); $artlist = ""; $rowss=$this->dsql->GetOne($query); if(!$rowss){ $artlist ="抱歉!暂无相关记录
"; }else{ if($col>1) { $artlist = "
\r\n"; } if($row = $this->dsql->GetArray("al")) { if($this->ChannelType< 0 || $this->ChannelTypeid< 0) { $row["id"]=$row["aid"]; $row["ismake"]=empty($row["ismake"])? "" : $row["ismake"]; $row["filename"]=empty($row["filename"])? "" : $row["filename"]; $row["money"]=empty($row["money"])? "" : $row["money"]; $row["description"]=empty($row["description "])? "" : $row["description"]; $row["pubdate"]=empty($row["pubdate "])? $row["senddate"] : $row["pubdate"]; } //处理一些特殊字段 $row["arcurl"] = GetFileUrl($row["id"],$row["typeid"],$row["senddate"],$row["title"], $row["ismake"],$row["arcrank"],$row["namerule"],$row["typedir"],$row["money"],$row['filename'],$row["moresite"],$row["siteurl"],$row["sitepath"]); $row["description"] = $this->GetRedKeyWord(cn_substr($row["description"],$infolen)); $row["title"] = $this->GetRedKeyWord(cn_substr($row["title"],$titlelen)); $row["id"] = $row["id"]; if($row['litpic'] == '-' || $row['litpic'] == '') { $row['litpic'] = $GLOBALS['cfg_cmspath'].'/images/defaultpic.gif'; } if(!preg_match("/^http:\/\//", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') { $row['litpic'] = $GLOBALS['cfg_mainsite'].$row['litpic']; } $row['picname'] = $row['litpic']; $row["typeurl"] = GetTypeUrl($row["typeid"],$row["typedir"],$row["isdefault"],$row["defaultname"],$row["ispart"],$row["namerule2"],$row["moresite"],$row["siteurl"],$row["sitepath"]); $row["info"] = $row["description"]; $row["filename"] = $row["arcurl"]; $row["stime"] = GetDateMK($row["pubdate"]); $row["textlink"] = "".$row["title"].""; $row["typelink"] = "[".$row["typename"]."]"; $row["imglink"] = ""; $row["image"] = ""; $row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl']; $row['memberurl'] = $GLOBALS['cfg_memberurl']; $row['templeturl'] = $GLOBALS['cfg_templeturl']; if(is_array($this->dtp2->CTags)) { foreach($this->dtp2->CTags as $k=>$ctag) { if($ctag->GetName()=='array') { //传递整个数组,在runphp模式中有特殊作用 $this->dtp2->Assign($k,$row); } else { if(isset($row[$ctag->GetName()])) { $this->dtp2->Assign($k,$row[$ctag->GetName()]); } else { $this->dtp2->Assign($k,''); } } } } $artlist .= $this->dtp2->GetResult(); }//if hasRow else { $artlist .= ""; } if($col>1) $artlist .= " | \r\n"; }//Loop Col if($col>1) { $artlist .= "