搜索

让海洋CMS的导演和演员数据支持斜杠/分隔符

[复制链接]
admin 发表于 2018-8-25 11:21:17 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?注册加入

x
编辑 /include/common.func.php 文件第1386行,找到
  1. function getKeywordsList($key,$span){
  2.     if($key=='')return $key;
  3.     $keyWordsStr="";
  4.     $keystr=str_replace(",",",",$key);
  5.     if (strpos($keystr,",")>0){$keyWordsArray=explode(",",$keystr);}else{$keyWordsArray=explode(" ",$keystr);}
  6.     for($kli=0;$kli<count($keyWordsArray);$kli++){
  7.         $keyWordsStr.="<a href='/".$GLOBALS['cfg_cmspath']."search.php?searchword=".urlencode($keyWordsArray[$kli])."'>".$keyWordsArray[$kli]."</a>".$span;
  8.     }
  9.     return $keyWordsStr;
  10. }

  11. function getJqList($key,$span){
  12.     if($key=='')return $key;
  13.     $keyWordsStr="";
  14.     $keystr=str_replace(",",",",$key);
  15.     if (strpos($keystr,",")>0){$keyWordsArray=explode(",",$keystr);}else{$keyWordsArray=explode(" ",$keystr);}
  16.     for($kli=0;$kli<count($keyWordsArray);$kli++){
  17.         $keyWordsStr.="<a href='/".$GLOBALS['cfg_cmspath']."search.php?searchtype=5&jq=".urlencode($keyWordsArray[$kli])."'>".$keyWordsArray[$kli]."</a>".$span;
  18.     }
  19.     return $keyWordsStr;
  20. }
复制代码
修改为
  1. function getKeywordsList($key,$span){
  2.     if($key=='')return $key;
  3.     $keyWordsStr="";
  4.     $keystr=str_replace(",",",",$key);
  5.     $keystr=str_replace(" / ",",",$key);
  6.     if (strpos($keystr,",")>0){$keyWordsArray=explode(",",$keystr);}else{$keyWordsArray=explode(" ",$keystr);}
  7.     for($kli=0;$kli<count($keyWordsArray);$kli++){
  8.         $keyWordsStr.="<a href='/".$GLOBALS['cfg_cmspath']."search.php?searchword=".urlencode($keyWordsArray[$kli])."'>".$keyWordsArray[$kli]."</a>".$span;
  9.     }
  10.     return $keyWordsStr;
  11. }

  12. function getJqList($key,$span){
  13.     if($key=='')return $key;
  14.     $keyWordsStr="";
  15.     $keystr=str_replace(",",",",$key);
  16.     if (strpos($keystr,",")>0){$keyWordsArray=explode(",",$keystr);}else{$keyWordsArray=explode(" ",$keystr);}
  17.     for($kli=0;$kli<count($keyWordsArray);$kli++){
  18.         $keyWordsStr.=" / <a href='/".$GLOBALS['cfg_cmspath']."search.php?searchtype=5&jq=".urlencode($keyWordsArray[$kli])."'>".$keyWordsArray[$kli]."</a>".$span;
  19.     }
  20.     return $keyWordsStr;
  21. }
复制代码
此时已经实际将斜杠转换成SeaCMS默认的空格分隔符效果。

如果要像豆瓣那样中间有不带超链接的斜杠分隔,继续修改:
编辑 /include/mkhtml.func.php 文件第507行,找到
  1. $content=str_replace("{playpage:actor}",getKeywordsList($v_actor," "),$content);
  2. $content=str_replace("{playpage:director}",getKeywordsList($row['v_director']," "),$content);
复制代码
修改为:
  1. $content=str_replace("{playpage:actor}",getKeywordsList($v_actor," / "),$content);
  2. $content=str_replace("{playpage:director}",getKeywordsList($row['v_director']," / "),$content);
复制代码




原文:https://www.2dan.cc/seacms/xiegang-fengefu.html

小黑屋|海洋CMS

GMT+8, 2019-2-16 06:16 , Processed in 0.096702 second(s), 22 queries .

Powered by SeaCMS!

© 2015-2018 seacms.net.

快速回复 返回顶部 返回列表