0
我會盡力在這裏做到徹底和簡短。我目前第一次在Joomla工作,但之前我已經開發過。我使用Joomla 3.4。我正在嘗試做什麼: 用戶通過指向他們的優惠券的特定頁面註冊我們的通訊。 下一頁顯示他們的優惠券,並在該URL的郵件標籤(即&電子郵件=「電子郵件」) 我想一個模塊內的代碼來解析出該電子郵件發送優惠券的拷貝到用戶的電子郵件自動。Joomla JMail代碼不工作 - Javascript正常工作
當任何用戶訂閱我不能使用一般的自動電子郵件,因爲只有從特定網頁註冊用戶將獲得優惠券。我已關閉所有文本過濾功能,並使用基本的模塊編輯器。當我保存模塊時,代碼在編輯框中顯示得很好。當我查看頁面的源代碼時,該腳本標籤仍然存在,但代碼將全部爲空。我現在已經進入phpmyadmin,並可以直接在那裏編輯模塊。現在,劇本顯示得很好。
我已經嘗試了很多不同的修復,其中包括以繞過與MooTools的任何問題,增加了jQuery($)
功能負荷。想知道這是否是Javascript的問題,我清除了腳本,並製作了一個簡單的alert("Testing...");
腳本,在頁面上觸發得很好。這意味着我的完整腳本中必須有某些內容不能正常工作。任何幫助或其他想法都會很棒。我已經花了一整天的時間在這方面了,而且我已經很聰明瞭。下面的代碼:
<script type="text/javascript">
function get(name){
if(name=(new RegExp('[?&]'+encodeURIComponent(name)+'=([^&]*)')).exec (window.location.search))
$recipient = decodeURIComponent(name[1]);
}
$mailer = JFactory::getMailer();
$config = JFactory::getConfig();
$sender = array(
$config->get('config.mailfrom'),
$config->get('config.fromname')
);
$mailer->setSender($sender);
get('email');
$mailer->addRecipient($recipient);
$body = '<h2>Thank you for joining our mailing list!</h2>
'<div>Here is your coupon for a FREE 8" 1-topping pizza at Goodfellas!'
'<img src="http://www.goodfellas309.com/main/images/pizzacoupon.jpg" alt="pizza coupont"/></div>';
$mailer->isHTML(true);
$mailer->Encoding = 'base64';
$mailer->setSubject('Your Free Pizza!');
$mailer->setBody($body);
$send = $mailer->Send;
if ($send !== true) {
echo 'Error sending email: ' . $send->__toString();
} else {
alert("An email with your coupon has been sent to you! Thank you for joining our mailing list!");
}
');
</script>
我甚至通過的Joomla嘗試內嵌PHP解析這段代碼包裹的javascript:
<?php
$document = JFactory::getDocument();
$document->addScriptDeclaration('
-Javascript here-
');
?>
我一直喜歡的StackOverflow和回答問題,已經得到了我出去這麼多果醬。我無法在任何地方找到答案。謝謝你的時間!
你有你的JavaScript和PHP的所有混合起來。 php部分不知道js在做什麼,也不知道在哪裏發送電子郵件。此外,'