Tell a friend tag - need help with $pageURL

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
harleyquinn
Forum Members
Forum Members
Posts: 36
Joined: Fri Dec 22, 2006 4:29 pm

Tell a friend tag - need help with $pageURL

Post 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!
harleyquinn
Forum Members
Forum Members
Posts: 36
Joined: Fri Dec 22, 2006 4:29 pm

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

Post 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!
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm

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

Post 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
Post Reply

Return to “CMSMS Core”