how to get the current url in a user defined tag [SOLVED]

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
isaacd
Forum Members
Forum Members
Posts: 32
Joined: Wed Dec 16, 2009 12:54 am

how to get the current url in a user defined tag [SOLVED]

Post by isaacd »

Hello.

I am trying to get the current url in a user defined tag. I tried the method suggested on http://wiki.cmsmadesimple.org/index.php ... fined_Tags , and it did not work correctly. This is what it is:

 global $gCms;
 $hm =& $gCms->GetHierarchyManager();
 $curnode =& $hm->getNodeById($page_content_id);
 $curcontent =& $curnode->GetContent();
 echo 'Page URL: ' . $curcontent->GetURL();

I also tried changing $page_content_id to $page_id, and $content_id (I looked at the template vars and I think $contnet_id is correct).

What happens is any content below the tag is simply not displayed.

Thanks in advance
   Isaac.
Last edited by isaacd on Sun Feb 14, 2010 6:14 pm, edited 1 time in total.
JeremyBASS

Re: how to get the current url in a user defined tag

Post by JeremyBASS »

that only works if you’re on a page... ie: if you’re in let’s say news, and you move to an article it'll fail... so there is a udt I wrote .. I think it's in the tips and tricks that get the url no matter where in the site your at... if you can't find it in the tips and tricks area (it's from 6mnt-a year ago) I can dig it up.. It'll just be a bit...

Cheers
Jeremy
isaacd
Forum Members
Forum Members
Posts: 32
Joined: Wed Dec 16, 2009 12:54 am

Re: how to get the current url in a user defined tag

Post by isaacd »

JeremyBASS,

I found this of yours:

http://forum.cmsmadesimple.org/index.ph ... 018.0.html

The second block of code gets the url, with the exception that "assume_mod_rewrite" is changed to "url_rewriting", and the option "true" is changed to "mod_rewrite".

Thanks
JeremyBASS

Re: how to get the current url in a user defined tag [SOLVED]

Post by JeremyBASS »

Super, Glad I was some help... good karma for the soul :D... yeah that post was in the time of cmsms 1.5.4 ... so it needs some updating... glad you got it.. Cheers -Jeremy
Post Reply

Return to “CMSMS Core”