【发布时间】:2013-03-12 15:16:21
【问题描述】:
我在一个tellform表单的.php文件中有以下几行:
// Gets the current URL
function CurrentPageURL()
{
$pageURL = $_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://';
$pageURL .= $_SERVER['SERVER_PORT'] != '80' ? $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"] : $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
return $pageURL;
}
$url = CurrentPageURL();
在下面的某个地方:
$message = "Hi! blahblahblah : $url";
另外,在 .tpl 文件中我有以下行:
<form id="tellform" action="tellafriend/processTell.php" method="post">
一切正常,除了发送的电子邮件包含 /tellafriend/processTell.php 的链接,而不是浏览器中显示的产品的实际链接。 我应该怎么做才能纠正这个问题? 谢谢!
编辑 1 这是关于提交电子邮件的 .js 部分:
// Use Ajax to send everything to processTell.php
submitHandler: function(form) {
$("#send").attr("value", "Slanje...");
$(form).ajaxSubmit({
success: function(responseText, statusText, xhr, $form) {
$(form).slideUp("fast");
$("#response-tell").html(responseText).hide().slideDown("fast");
}
});
return false;
}
已解决
所以,多亏了 IMSoP,我解决了这个问题。
他解释了问题出在哪里,所以最后我明白了。
我完全删除了这个 function CurrentPageURL 行,并在相关表单的 .tpl 页面中插入了以下代码:
<input type="hidden" name="urlToPutInEmail" value="<?php echo $this->url->link('product/product', 'product_id=' . $product_id); ?>" />
在tellform.php 文件中,我调用了变量$urlToPutInEmail。
简单的就是……
注意,这是在 opencart 框架上工作的。
再次感谢 IMSoP!
【问题讨论】:
-
抱歉,您没有显示任何电子邮件生成代码,因此很难为您提供帮助。
-
@Raad,我添加了一些代码...请检查并建议。