Page 1 of 1

Page URL tag to show complete url

Posted: Fri Apr 03, 2009 10:18 am
by chaszu
Hi All,

I'm trying to use this tag:

global $gCms;
  $hm =& $gCms->GetHierarchyManager();
  $curnode =& $hm->getNodeById($gCms->variables["page_id"]);
  $curcontent =& $curnode->GetContent();
  echo 'Page URL: ' . $curcontent->GetURL();

in the page template, and it gives me:

Page URL: http://DOMAIN.COM/index.php/page-alias

But the REAL URL of that page is:

Page URL: http://DOMAIN.COM/index.php?mact=_page- ... eturnid=56 .....

So How can I retrive the COMPLETE URL that I actually see in the browser url bar?

Thanks!

Re: Page URL tag to show complete url

Posted: Fri Apr 03, 2009 10:55 am
by Ted
There's a pretty standard php recipe for that:

Code: Select all

$uri = 'http'. ($_SERVER['HTTPS'] ? 's' : '') .'://'. $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

[solved] Re: Page URL tag to show complete url

Posted: Wed Jun 03, 2009 11:04 pm
by geepers

Code: Select all

$uri = 'http'. ($_SERVER['HTTPS'] ? 's' : '') .'://'. $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
is there a simple way to get the $uri variable available within an existing module? and how would you go about doing that?

i want to be able to use the above $uri value in a comparison string within a modules template.

UPDATE
Used smarty to retrieve what I needed.

Code: Select all

{$smarty.get.page}
This returned everything that would normally follow '?page=' - even returns the correct value when using friendly url's and mod_rewrite.