發佈日期:
分類:
如何自訂phpList設定(1)
安裝好phplist後,以為事件已是一了百了的話,似乎言之過早。今天又來了新的要求:假設phplist是安裝在以下環境下。
伺服器地址:http://192.168.0.100
phplist安裝位置:http://192.168.0.100/lists/
phplist內通訊數目:1個
phplist內通訊名稱:News from 192.168.0.100
01. 怎樣把phplist整合到自己的網站。只需要在網站內,加入以下Form及javascript,便可以連接到phplist訂閱(subscribe)版面,但留意是因phplist需用戶在輸入電郵時同時確認電郵正確,故需要另外javascript控制Form submit工作。
<script type="text/javascript"> var fieldstocheck = new Array(); var fieldnames = new Array(); function addFieldToCheck(value,name) { fieldstocheck[fieldstocheck.length] = value; fieldnames[fieldnames.length] = name; } function checkform() { document.subscribeform.emailconfirm.value = document.subscribeform.email.value; for (i=0;i<fieldstocheck.length;i++) { if (eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].value") == "" || eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].value") == "Email") { eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()"); showDialog('Warning','Please enter your Email address.<br><br><br><br><br><br><br><br><br><a href=#>Close</a>','warning'); return false; } if (!checkEmail(eval("document.subscribeform.elements['"+fieldstocheck[i]+"']"))) { showDialog('Warning','Please enter a valid Email address.<br><br><br><br><br><br><br><br><br><a href=#>Close</a>','warning'); return false; } } document.subscribeform.submit(); } function checkEmail(field) { var goodEmail = field.value.match(/\\b(^(\\S+@).+((\\.com)|(\\.net)|(\\.edu)|(\\.mil)|(\\.gov)|(\\.org))$)\\b/gi); return goodEmail; } </script> <form method=post name="subscribeform" action="/lists/?p=subscribe" onSubmit="return checkform();"> <input type=text name=email value="" size="30"><script language="Javascript" type="text/javascript">addFieldToCheck("email","Email");</script> <input type="hidden" name=emailconfirm value="" size="30"> <input type="hidden" name="htmlemail" value="1"/></span> <input type="hidden" name="list[1]" value="signup"> <input type="hidden" name="listname[1]" value="News from 192.168.0.100"/> <input type=submit name="subscribe" value="Subscribe"> </form>
02. 用戶訂閱通訊(subscribe newsletter)後,令phplist連接到自訂版面。打開lists/admin目錄下的subscribelib2.php檔案。找尋以下部份:
將: $thankyoupage = '<h3>'.$strThanks.'</h3>'. $strEmailConfirmation; 更改為訂閱(subscribe)後,需要連接到的位置: $thankyoupage = header("location: ../subscribe.php?id=success");
03. 用戶訂閱通訊(subscribe newsletter)後,自動將其確認為正式用戶。打開lists/admin目錄下的subscribelib2.php檔案。找尋以下部份:
將: htmlemail,subscribepage,rssfrequency) values("%s",now(),"%s",0,%d,%d,"%s")', 更改為: htmlemail,subscribepage,rssfrequency) values("%s",now(),"%s",1,%d,%d,"%s")',
04. 用戶取消訂閱通訊(unsubscribe newsletter)後,令phplist連接到自訂版面。打開lists目錄下的index.php檔案。找尋以下部份:
將: if ($userid) $res .= '<h1>'.$GLOBALS["strUnsubscribeDone"] ."</h1><P>"; 更改為: if ($userid) $res = header("location: ../unsubscribe.php?p=unsubscribed");
05. 用戶點選取消訂閱通訊(unsubscribe newsletter)後,不要求輸入取消訂閱理由,而直接跳到取消訂閱版面。打開lists/config目錄下的config.php檔案。找尋以下部份:
將: define("UNSUBSCRIBE_JUMPOFF",0); 更改為: define("UNSUBSCRIBE_JUMPOFF",1);)
06. 用戶取消訂閱通訊(unsubscribe newsletter)後,系統會把此電郵設定為黑名單,當用戶再次訂閱通訊時,同時取消黑名單。
打開lists/admin目錄下的subscribelib2.php檔案。找尋以下部份:
在以下句子上面: # personalise the thank you page 加入以下內容: # personalise the thank you page if ($blacklisted) { Sql_query(sprintf('delete from %s where email = "%s"','phplist_user_blacklist',$email)); Sql_query(sprintf('delete from %s where email = "%s"','phplist_user_blacklist_data',$email)); }
發佈留言