• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.4 Is there a way to grab the current URL using a {xx} command?

#1
This is a little hard to explain, but I am trying to create a Notice that includes a link that is relative to the page currently being viewed.

Essentially I'm trying to do the following:
Code:
<a href="{current_url}/my_own_variable">
Sadly current_url is just made up, but I'm hoping there might be a way to grab the current URL, a bit like how you can grab the current username using {name}.
 
#3
As I essentially just need to add "calendar-add" after the current URL, I thought I could just go for:

Code:
<a href="/calendar-add">click here</a>
Sadly, because XenForo uses a Base tag in the header, this doesn't work.
 

Mr. Goodie2Shoes

Well-known member
#4
Okay, so I did a little digging for you and found that creating a simple event listener to add the value of the current URI to the notice is possible :D
 
#5
Thanks for that. In the end I just used javascript, and the document.URL variable. So created:

Code:
<a href="javascript:location.replace(document.URL + 'calendar-add')">Link</a>
Seems to work.