Page 1 of 1

Tell a friend tag - need help with $pageURL

Posted: Sun Jun 17, 2007 4:39 am
by harleyquinn
I'm using the Tell a friend tag and modified the function to open the form in a new window with the help of this post: http://forum.cmsmadesimple.org/index.php/topic,8698.msg54035.html#msg54035.

It works, but the one problem I can't figure out is how to fix the way the url displays in the email message. Instead of being http://www.website.com/page, it displays: http://www.website.comhttp://www.website.com/page/

I'm assuming it has something to do with this code:

Code: Select all

$pageURL = "\r\n\r\nhttp";
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["HTTP_REFERER"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["HTTP_REFERER"];
 }
Unfortunately I suck at PHP and can't figure out what to modify to make the referring URL display correctly in the email message. I tried playing around with it, but no luck.

Can someone please help?

Thanks!

Re: Tell a friend tag - need help with $pageURL

Posted: Sun Jun 17, 2007 4:48 pm
by harleyquinn
Thanks Samalah for responding. I saw that post earlier, but it wasn't the fix I was looking for.

After playing around with the code some more, I think I got it to work. I basically just trimmed the code down from

Code: Select all

$pageURL = "\r\n\r\nhttp";
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["HTTP_REFERER"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["HTTP_REFERER"];
 }
to

Code: Select all

 $pageURL = "\r\n";
$pageURL .= $_SERVER["HTTP_REFERER"];
Being completely PHP impaired, I hope that what I took out wasn't something vital to the script. If anyone could let me know if there is a better solution, I'm open to any suggestions.

Thanks again!

Re: Tell a friend tag - need help with $pageURL

Posted: Mon Jun 18, 2007 11:42 am
by RonnyK
Harleyquinn,

I used the same REFERER logic, as I wanted the page to open as well in a popup/different page, the default logic, gave the current (opening window) back instead of the page you clicked the link on (referring)

Ronny