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

Current XF URL from within media site HTML callback code?

Discussion in 'XenForo Development Discussions' started by Kevin, Jan 20, 2014.

  1. Kevin

    Kevin Well-Known Member

    OK, this may seem like a silly question to some, but what is the easiest way of getting the current page URL from within PHP code in a media site HTML callback?

    I know I can use buildPublicLink to create a new XF formatted link but is there a corresponding 'get current public link' for whatever page the media is being shown on instead of using _server variables to build it?:oops:
     
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    You may be able to use the
    PHP:
    $_SERVER['REQUEST_URI']
    variable to retrieve it.
     
  3. Kevin

    Kevin Well-Known Member

    Thanks, I was hoping there was already an XF variable defined instead of having to recreate it using the _server variables.

    I ended up going with a slightly modified version of this snippet http://stackoverflow.com/a/8891890 and it works exactly as I was hoping it would with my code in question.
     

Share This Page