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

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
rustyk
New Member
New Member
Posts: 4
Joined: Thu Aug 09, 2007 12:54 am

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

Post 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
so what?
Forum Members
Forum Members
Posts: 17
Joined: Thu Nov 27, 2008 3:38 am

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

Post 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?
Last edited by so what? on Fri Nov 28, 2008 6:12 pm, edited 1 time in total.
Post Reply

Return to “CMSMS Core”