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.
how to get the current url in a user defined tag [SOLVED]
how to get the current url in a user defined tag [SOLVED]
Last edited by isaacd on Sun Feb 14, 2010 6:14 pm, edited 1 time in total.
Re: how to get the current url in a user defined tag
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
Cheers
Jeremy
Re: how to get the current url in a user defined tag
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
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
Re: how to get the current url in a user defined tag [SOLVED]
Super, Glad I was some help... good karma for the soul
... yeah that post was in the time of cmsms 1.5.4 ... so it needs some updating... glad you got it.. Cheers -Jeremy
