全国400电话网上服务平台
强大号码库资源任选,方便,快捷,快速开通。
咨询热线:400-1100-266
强大号码库资源任选,方便,快捷,快速开通。
咨询热线:400-1100-266
DEDECMS文件保存目录直接转英文的方法
POST TIME:2017-11-30 22:25
有的朋友喜欢把dedecms文件保存目录直接用英文,那么可以通过以下方法。
修改文件:dede/templets/catalog_add.htm
functionCheckTypeDir()
在这个函数下方增加
functionCheckgoogle(){
vargoogle=document.getElementById('google');
vartpobj=document.getElementById('typedir');
varupinyin=document.getElementById('pinyin');
if(google.checked)tpobj.style.display="none";
elsetpobj.style.display="block";
if(google.checked)upinyin.style.display="none";
elseupinyin.style.display="block";
}
vargoogle=document.getElementById('google');
vartpobj=document.getElementById('typedir');
varupinyin=document.getElementById('pinyin');
if(google.checked)tpobj.style.display="none";
elsetpobj.style.display="block";
if(google.checked)upinyin.style.display="none";
elseupinyin.style.display="block";
}
搜索
<inputclass="np"id="upinyin"onclick="CheckTypeDir()"type="checkbox"name="upinyin"value="1"/>
替换为
<spanid="pinyin"><inputclass="np"id="upinyin"onclick="CheckTypeDir()"type="checkbox"name="upinyin"value="1"/>拼音</span>
<spanid="en"><inputclass="np"id="google"onclick="Checkgoogle()"type="checkbox"name="google"value="1"/>英文</span>
<spanid="en"><inputclass="np"id="google"onclick="Checkgoogle()"type="checkbox"name="google"value="1"/>英文</span>
dede/catalog_add.php
搜索
//用拼音命名
在其下方增加
//用谷歌翻译英文
if($google==1||$typedir=='')
{
$typedir=googleTran(stripslashes($typename));
}
if($google==1||$typedir=='')
{
$typedir=googleTran(stripslashes($typename));
}
/include/extend.func.php
最末尾增加
functiongoogleTran($text){
if(empty($text))return"";
$wf=@file_get_contents('http://translate.google.cn/translate_t?sl=zh-CN&tl=en&text='.$text.'#');
if(false===$wf||empty($wf))
{
returnfalse;
}
$return="";
$star="style.backgroundColor='\#fff'\&;>";
$end="
";
$p="#{$star}(.*){$end}#iU";//i表示忽略大小写,U禁止贪婪匹配
if(preg_match_all($p,$wf,$rs))
{
return$rs[1][0];
}
}
if(empty($text))return"";
$wf=@file_get_contents('http://translate.google.cn/translate_t?sl=zh-CN&tl=en&text='.$text.'#');
if(false===$wf||empty($wf))
{
returnfalse;
}
$return="";
$star="style.backgroundColor='\#fff'\&;>";
$end="
";
$p="#{$star}(.*){$end}#iU";//i表示忽略大小写,U禁止贪婪匹配
if(preg_match_all($p,$wf,$rs))
{
return$rs[1][0];
}
}
Copyright © 2003-2016
时间:9:00-21:00 (节假日不休)
版权所有:巨人网络(扬州)科技有限公司
总部地址:江苏省信息产业基地11号楼四层
《增值电信业务经营许可证》 苏B2-20120278

时间:9:00-21:00 (节假日不休)
版权所有:巨人网络(扬州)科技有限公司
总部地址:江苏省信息产业基地11号楼四层
《增值电信业务经营许可证》 苏B2-20120278

