Page 1 of 1

Geting url data

Posted: Wed Jan 20, 2021 3:33 pm
by andrewvideouk
I have a created a page in CMSMS and I would like to get information from the URL for example

I have a page at https://www.website.com/page

I have noiced if I do something like https://www.website.com/page?#44faa6d7 is still go the page. That all good.

I want to get the ?#44faa6d7 part or url and add it to a variable so I can use it in a template.

What is the best way of doing this.

Thank you and happy new year

Re: Geting url data

Posted: Wed Jan 20, 2021 4:47 pm
by DIGI3
It's hard to tell if you're trying to get a url parameter or an anchor, as your example seems to be a mix of both. For a url parameter (?foo=bar) you can use {$smarty.get.foo}

If you're trying to get the anchor (#foo) then you'll probably need to use javascript as that information isn't sent to the server.

url parameters can't contain '#', that's reserved for anchors.

Re: Geting url data

Posted: Wed Jan 20, 2021 5:07 pm
by andrewvideouk
Thank you very much, That worked,