Page 1 of 1

Question about getting the current page url in a user defined tag

Posted: Sat Apr 12, 2008 12:07 am
by rustyk
Is this the best way to get the page URL when writing a user defined tag?

global $gCms;
$hm =& $gCms->GetHierarchyManager();
$pageinfo = &$gCms->variables['pageinfo'];
$content_id = $pageinfo->content_id;
$curnode =& $hm->getNodeById($content_id);
$curcontent =& $curnode->GetContent();
$current_url = $curcontent->GetURL();

... or is there some better/less_code way to do it?

Thanks!
rustyk

Re: Question about getting the current page url in a user defined tag

Posted: Thu Nov 27, 2008 3:48 am
by so what?
Hi rustyk

Sorry for my late answer. A shorter way would be:

global $gCms;
$config =& $gCms->GetConfig();
$current_url = $config['root_url'] . "/" . $_GET['page'];


Have a good time.

so what?