SeaCMS支持斜杠分隔符

编辑 /include/common.func.php 文件第1386行,找到

function getKeywordsList($key,$span){
    if($key=='')return $key;
    $keyWordsStr="";
    $keystr=str_replace(",",",",$key);
    if (strpos($keystr,",")>0){$keyWordsArray=explode(",",$keystr);}else{$keyWordsArray=explode(" ",$keystr);}
    for($kli=0;$kli<count($keyWordsArray);$kli++){
        $keyWordsStr.="<a href='/".$GLOBALS['cfg_cmspath']."search.php?searchword=".urlencode($keyWordsArray[$kli])."'>".$keyWordsArray[$kli]."</a>".$span;
    }
    return $keyWordsStr;
}

function getJqList($key,$span){
    if($key=='')return $key;
    $keyWordsStr="";
    $keystr=str_replace(",",",",$key);
    if (strpos($keystr,",")>0){$keyWordsArray=explode(",",$keystr);}else{$keyWordsArray=explode(" ",$keystr);}
    for($kli=0;$kli<count($keyWordsArray);$kli++){
        $keyWordsStr.="<a href='/".$GLOBALS['cfg_cmspath']."search.php?searchtype=5&jq=".urlencode($keyWordsArray[$kli])."'>".$keyWordsArray[$kli]."</a>".$span;
    }
    return $keyWordsStr;
}


修改为

function getKeywordsList($key,$span){
    if($key=='')return $key;
    $keyWordsStr="";
    $keystr=str_replace(",",",",$key);
    $keystr=str_replace(" / ",",",$key);
    if (strpos($keystr,",")>0){$keyWordsArray=explode(",",$keystr);}else{$keyWordsArray=explode(" ",$keystr);}
    for($kli=0;$kli<count($keyWordsArray);$kli++){
        $keyWordsStr.="<a href='/".$GLOBALS['cfg_cmspath']."search.php?searchword=".urlencode($keyWordsArray[$kli])."'>".$keyWordsArray[$kli]."</a>".$span;
    }
    return $keyWordsStr;
}

function getJqList($key,$span){
    if($key=='')return $key;
    $keyWordsStr="";
    $keystr=str_replace(",",",",$key);
    if (strpos($keystr,",")>0){$keyWordsArray=explode(",",$keystr);}else{$keyWordsArray=explode(" ",$keystr);}
    for($kli=0;$kli<count($keyWordsArray);$kli++){
        $keyWordsStr.=" / <a href='/".$GLOBALS['cfg_cmspath']."search.php?searchtype=5&jq=".urlencode($keyWordsArray[$kli])."'>".$keyWordsArray[$kli]."</a>".$span;
    }
    return $keyWordsStr;
}

此时已经实际将斜杠转换成SeaCMS默认的空格分隔符效果。

如果要像豆瓣那样中间有不带超链接的斜杠分隔,继续修改:

编辑 /include/mkhtml.func.php 文件第507行,找到

$content=str_replace("{playpage:actor}",getKeywordsList($v_actor,"&nbsp;"),$content);
$content=str_replace("{playpage:director}",getKeywordsList($row['v_director'],"&nbsp;"),$content);

修改为:

$content=str_replace("{playpage:actor}",getKeywordsList($v_actor,"&nbsp;/&nbsp;"),$content);
$content=str_replace("{playpage:director}",getKeywordsList($row['v_director'],"&nbsp;/&nbsp;"),$content);

标签:斜杠, 分隔

添加新评论