Home >CMS Tutorial >DEDECMS >How to use dedecms to display the file name of the article title page in pinyin

How to use dedecms to display the file name of the article title page in pinyin

藏色散人
藏色散人Original
2019-12-20 10:06:481927browse

How to use dedecms to display the file name of the article title page in pinyin

How to use dedecms to display the pinyin file name of the article title page?

Use dedecms to realize the method of displaying the pinyin file name of the article title page

Use dede to let the article title page display path as title pinyin.html, for example: article The title is: What is Zhanyou.com? The article path displays: zhanyouwangshishenmea.html. What are the benefits of displaying it this way? Damn, do I even need to say this?

Recommended learning: 梦Weavercms

Use dede to display the pinyin file name of the article title page

As the title says, use dede to display the path on the article title page Pinyin.html for the title, for example: the article title is: What is Zhanyou.com, and the article path displays: zhanyouwangshishenmea.html. What are the benefits of this display? Damn, do I even need to say this?

Method:

Select: Website column management, modify the advanced options of the column, article naming rules: {typedir}/{Y}{M}{D}/{aid}.html this It is the default state

Modified to: {typedir}/{pinyin}.html I think {Y}{M}{D} is useless, so I removed it.

Update again and see if it has any effect?

Don’t worry, the pinyin is now displayed, zhanyouwangshishenmea_1.html, but there is an extra _1 at the end. How to remove this?

Modify the inc_channel_unit_function file in include and find $articleRule = str_replace("{pinyin}",GetPinyin($title)."_".$aid,$articleRule); put."_".$aid Just remove it and that’s it!

If the article title is in English, _ will be added between the words, but adding _ in the middle of the word has no meaning for gg. It must be changed to "-". The modification method is as follows

Open include/inc/inc_fun_funAdmin.php

The code is as follows:

for($i=0;$i<$slen;$i++){ 
if(ord($str[$i])>0x80) 
{ 
$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 .= "-"; } 
}

Change

$restr .= "-"; These things

pinyin middle Add "-"

Modify include\inc\inc_fun_funAdmin.php

The code is as follows:

for($i=0;$i<$slen;$i++){ 
if(ord($str[$i])>0x80) 
{ 
$c = $str[$i].$str[$i+1]; 
$i++; 
if(isset($pinyins[$c])){ 
if($ishead==0) $restr .= $pinyins[$c]."-"; 
if($isclose==0) unset($pinyins); 
if(substr($restr,-1)=="-") $restr = substr($restr,0,strlen($restr)-1); 
return $restr; 
if(substr($restr,-1)=="-") $restr = substr($restr,0,strlen($restr)-1);

is the newly added

The above is the detailed content of How to use dedecms to display the file name of the article title page in pinyin. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn