步驟 1
於網站根目錄下建立檔案cami.php程式碼
<?phpif(isset($_SERVER["HTTP_REFERER"]) && strpos($_SERVER["HTTP_REFERER"], "cami.yesing.com") !== FALSE && isset($_GET["from"]) && !empty($_GET["from"]))
{
header("".$_SERVER["SERVER_PROTOCOL"]." 301 Moved Permanently");
header("Location: ".$_GET["from"]."");
exit();
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Cami 線上客服系統</title>
<style type="text/css">
html, body
{
margin:0;
padding:0;
overflow:hidden;
}
</style>
</head>
<body>
</body>
</html>
步驟 2
於建立的cami.php中 加入cami安裝語法,範例如下(灰底白字部份為此步驟中加入的Cami安裝語法)<?php
if(isset($_SERVER["HTTP_REFERER"]) && strpos($_SERVER["HTTP_REFERER"], "cami.yesing.com") !== FALSE && isset($_GET["from"]) && !empty($_GET["from"]))
{
header("".$_SERVER["SERVER_PROTOCOL"]." 301 Moved Permanently");
header("Location: ".$_GET["from"]."");
exit();
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Cami 線上客服系統</title>
<style type="text/css">
html, body
{
margin:0;
padding:0;
overflow:hidden;
}
</style>
<script type="text/javascript">
(function(){
var c = document.createElement("script");
c.type = "text/javascript";
c.src = ("https:" == document.location.protocol ? "https" : "http") + "://伺服器編號.cami.yesing.com.tw/patrol/static_v2/department/text/公司帳號";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(c, s);
})();
</script>
</head>
<body>
<div id="cami_system_include"></div>
</body>
</html>
步驟 3
於themes/default/library/page_header.lbi的最下方加入以下程式碼<script id="cami_for_ecshop" type="text/javascript">
function __cami_init(loop)
{
loop = loop || 0;
loop ++;
if(loop == 1)
{
var cami_for_ecshop = document.getElementById("cami_for_ecshop");
var add1 = document.createElement("style");
add1.type = "text/css";
add1.innerHTML = "#cami_iframe{ position:fixed; top:5px; right:5px; border:0; width:0; height:0; z-index:99999; }";
cami_for_ecshop.parentNode.insertBefore(add1, cami_for_ecshop);
var add2 = document.createElement("iframe");
add2.id = "cami_iframe";
add2.name = "cami_iframe";
add2.frameborder = "0";
add2.src = "cami.php?from="+encodeURIComponent(document.URL)+"";
cami_for_ecshop.parentNode.insertBefore(add2, cami_for_ecshop.nextSibling);
}
if(loop > 1000)
{
return false;
}
var cami_iframe_d = document.getElementById("cami_iframe");
if(typeof(cami_iframe_d) == "undefined")
{
setTimeout(function (){
__cami_init(loop);
}, 200);
return false;
}
var cami_iframe_w = window.frames["cami_iframe"];
if(typeof(cami_iframe_w) == "undefined")
{
setTimeout(function (){
__cami_init(loop);
}, 200);
return false;
}
var cami_system = cami_iframe_w._cami_system;
if(typeof(cami_system) == "undefined")
{
setTimeout(function (){
__cami_init(loop);
}, 200);
return false;
}
var cami_include = cami_iframe_w.document.getElementById("cami_system_include");
var cami_include_width = cami_include.offsetWidth;
var cami_include_height = cami_include.offsetHeight;
if(cami_include_width == 0 || cami_include_height == 0)
{
setTimeout(function (){
__cami_init(loop);
}, 200);
return false;
}
cami_iframe_d.style.width = cami_include_width + "px";
cami_iframe_d.style.height = cami_include_height + "px";
}
__cami_init();
</script>