DEDECMS文件保存目录直接转英文的方法



给大家分享一下织梦DEDECMS文件保存目录直接转英文的方法,有需要的朋友可以记录下,希望对你有帮助。
有的朋友喜欢把dedecms文件保存目录直接用英文,那么可以通过以下方法。
修改文件:dede/templets/catalog_add

function?CheckTypeDir()?
在这个函数下方增加

function?Checkgoogle(){?
var?google?=?document.getElementById('google');?
var?tpobj?=?document.getElementById('typedir');?
var?upinyin?=?document.getElementById('pinyin');?
if(google.checked)?tpobj.style.display?=?"none";?
else?tpobj.style.display?=?"block";?
if(google.checked)?upinyin.style.display?=?"none";?
else?upinyin.style.display?=?"block";?
}?
搜索

<input?class="np"?id="upinyin"?onclick="CheckTypeDir()"?type="checkbox"?name="upinyin"?value="1"?/>?
替换为

<span?id="pinyin"><input?class="np"?id="upinyin"?onclick="CheckTypeDir()"?type="checkbox"?name="upinyin"?value="1"?/>拼音</span>?
<span?id="en"><input?class="np"?id="google"?onclick="Checkgoogle()"?type="checkbox"?name="google"?value="1"?/>英文</span>?
dede/catalog_add.php?
搜索
?
//用拼音命名
在其下方增加
?
//用谷歌翻译英文

if($google==1?||?$typedir=='')?
{?
$typedir?=?googleTran(stripslashes($typename));?
}?
/include/extend.func.php?
最末尾增加

function?googleTran($text){?
if(empty($text))?return?"";?
$wf=@file_get_contents('http://translate.google/translate_t?sl=zh-CN&amp;tl=en&amp;text='.$text.'#');?
if?(false===$wf||empty($wf))?
{?
return?false;?
}?
$return?=?"";?
$star="style.backgroundColor='\#fff'\"&gt;";?
$end="?
??
";?
$p?=?"#{$star}(.*){$end}#iU";//i表示忽略大小写,U禁止贪婪匹配?
if(preg_match_all($p,$wf,$rs))?
{?
return?$rs[1][0];?
}?
}?
以上就是为大家整理的DEDECMS文件保存目录直接转换英文的方法,仅供学习参考。更改前请记得备份好文件数据。


上一篇:dedecms arclist中的自增变量 autoindex的说明

下一篇:dedecms列表页加载更多功能的实现


Copyright © 2002-2019 测速网 www.inhv.cn 皖ICP备2023010105号
测速城市 测速地区 测速街道 网速测试城市 网速测试地区 网速测试街道
温馨提示:部分文章图片数据来源与网络,仅供参考!版权归原作者所有,如有侵权请联系删除!

热门搜索 城市网站建设 地区网站制作 街道网页设计 大写数字 热点城市 热点地区 热点街道 热点时间 房贷计算器