首页 > 代码库 > 深圳网站建设系统:根据网站语言显示不同的客服信息

深圳网站建设系统:根据网站语言显示不同的客服信息

原来的程序默认是动态语言程序,虽然可以生成静态文件,比如英文站的生成在/en/目录下,但是生成的客服信息因会经常变化,不想每次更改客服信息也需要全站生成,就弄成动态调用了。需要对语言的php处理如下

case ‘kefu‘ :
($_GET[‘i‘] > $config[‘lang_total‘] || $_GET[‘i‘] < 1) && die(‘Parameter Error.‘);
if(isset($_COOKIE[‘mlecms_global_language‘])){
setcookie(‘mlecms_global_language‘,$_GET[‘i‘],$gmt_time + 2592000,‘/‘);
}
if($_COOKIE[‘mlecms_global_language‘] <> $_GET[‘i‘]){
echo(‘window.location.reload();‘);
}
echo(‘$(function(){‘);
echo(‘ $("#lrkfwarp").lrkf({‘);
echo(" kftop:‘140‘,");
echo(‘ defshow:false,‘);
//echo(" position:‘absolute‘,");
echo(‘ qqs:[‘);
foreach($web[‘qq‘] as $i => $qq){
if($i) echo ",";
echo "{‘name‘:‘售前".($i+1)."号‘,‘qq‘:‘".$qq."‘}";
}
echo(‘ ],‘);
echo(‘ skype:[‘);
foreach($web[‘skype‘] as $i => $skype){
if($i) echo ",";
echo "{‘name‘:‘".$skype."‘,‘skype‘:‘".$skype."‘}";
}
echo(‘ ],‘);
echo(‘ msn:[‘);
foreach($web[‘msn‘] as $i => $msn){
if($i) echo ",";
echo "{‘name‘:‘".$msn."‘,‘msn‘:‘".$msn."‘}";
}
echo(‘ ],‘);
echo(‘ wangwang:[‘);
foreach($web[‘wangwang‘] as $i => $wangwang){
if($i) echo ",";
echo "{‘name‘:‘".$wangwang."‘,‘wangwang‘:‘".$wangwang."‘}";
}
echo(‘ ],‘);
if($_GET[‘i‘] == 1){
echo("erweima:[ {‘name‘:‘二维码关注‘,‘erweima‘:‘".$web["erweima"]."‘} ],");
echo("tel:[ {‘name‘:‘24小时热线‘,‘tel‘:‘".$web["phone"][0]."‘}, {‘name‘:‘传真‘,‘tel‘:‘".$web["fax"][0]."‘} ],");
}else{
echo("erweima:[ {‘name‘:‘wechat‘,‘erweima‘:‘".$web["erweima"]."‘} ],");
echo("tel:[ {‘name‘:‘24 hour Hotline‘,‘tel‘:‘".$web["phone"][0]."‘}, {‘name‘:‘FAX‘,‘tel‘:‘".$web["fax"][0]."‘} ],");
}
if($_GET[‘i‘] == 1){
echo("more:‘".$config[‘url‘]."contact.html‘,more_title:‘>>更多方式‘});});");
}else{
echo("more:‘".$config[‘url‘]."contact.html‘,more_title:‘>>Contact Us‘});});");
}
/*echo ("var goumai = document.getElementById(‘goumai‘);");
echo ("if (goumai){");
if($_GET[‘i‘] == 1){
echo("document.getElementById(‘goumai‘).innerHTML =‘<a href=http://wpa.qq.com/msgrd?v=3&amp;uin=".$web[‘qq‘][0]."&amp;site=".$config[‘url‘]."&amp;menu=yes>立即咨询</a><a href=http://wpa.qq.com/msgrd?v=3&amp;uin=".$web[‘qq‘][1]."&amp;site=".$config[‘url‘]."&amp;menu=yes>立即咨询</a>‘;");
}else{
echo("document.getElementById(‘goumai‘).innerHTML =‘<a href=http://wpa.qq.com/msgrd?v=3&amp;uin=".$web[‘qq‘][0]."&amp;site=".$config[‘url‘]."&amp;menu=yes>Consult</a><a href=http://wpa.qq.com/msgrd?v=3&amp;uin=".$web[‘qq‘][0]."&amp;site=".$config[‘url‘]."&amp;menu=yes>Consult</a>‘;");
}
echo ("};");*/
break;
 
JS调用
<script language=‘javascript‘ src="http://www.mamicode.com/app.php?a=kefu&i={:$web[‘lang‘]:}" type=‘text/javascript‘ charset=‘utf-8‘></script>
 
转载请注明:本文转载自深圳市乐道网络科技 http://www.ledaokj.com/a-wlyx/176/809.html