讓DedeCMS文章標(biāo)題頁顯示路徑為“標(biāo)題拼音.html”,例如:文章標(biāo)題為:我是一個(gè)兵,文章路徑顯示:woshiyigebing.html
方法:
后臺-->網(wǎng)站欄目管理,修改欄目的高級選項(xiàng),文章命名規(guī)則:{typedir}/{Y}{M}{D}/{aid}.html
修改為:{typedir}/{pinyin}.html
{Y}{M}{D}沒什么用,所以去掉了。
更新一下文檔,woshiyigebing_1.html 出來了,但是后面還多了個(gè)_,怎么去掉這個(gè)呢?
修改文件:include/inc_channel_unit_function.php
在大約50多行的地方找到$articleRule = str_replace("{pinyin}",GetPinyin($title)."_".$aid,$articleRule); 把."_".$aid去掉,就可以了!
如果文章標(biāo)題是英文的,會在單詞之間加"_",但是單詞中間加_對SEO來說沒什么意義,那我們把它改成“-”。方法如下:
修改文件: include/inc/inc_fun_funAdmin.php
for($i=0;$i0x80) { $c = $str[$i].$str[$i+1]; $i++; if(isset($pinyins[$c])){ if($ishead==0) $restr .= $pinyins[$c]; else $restr .= $pinyins[$c][0]; }else $restr .= "_"; }else if( eregi("[a-z0-9]",$str[$i]) ){ $restr .= $str[$i]; } else{ $restr .= "_"; } }
如果我們想讓拼音也像英文那樣中間加“-”,方法是:
修改文件:include\inc\inc_fun_funAdmin.php文章來源:http://www.zghlxwxcb.cn/news/detail-433229.html
for($i=0;$i0x80) { $c = $str[$i].$str[$i+1]; $i++; if(isset($pinyins[$c])){ if($ishead==0) $restr .= $pinyins[$c]."-"; else $restr .= $pinyins[$c][0]; }else $restr .= "_"; }else if( eregi("[a-z0-9]",$str[$i]) ){ $restr .= $str[$i]; } else{ $restr .= "_"; } } if($isclose==0) unset($pinyins); if(substr($restr,-1)=="-") $restr = substr($restr,0,strlen($restr)-1); return $restr; }
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持yii666。文章來源地址http://www.zghlxwxcb.cn/news/detail-433229.html
到了這里,關(guān)于dede織夢自定義文件名之用拼音或英文標(biāo)題的方法的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!