TinyPortal

Development => Support => Topic started by: Inge Jones on May 22, 2012, 12:56:48 PM

Title: Can reference the forum url from a php block?
Post by: Inge Jones on May 22, 2012, 12:56:48 PM
I would like to be able to get the value of my forum's base url from within a php TP block.  I can't see it obviously in the $context array.  Is it available within a block?
Title: Re: Can reference the forum url from a php block?
Post by: ZarPrime on May 22, 2012, 04:17:33 PM
You'd have to use the variable "$scripturl" for that, and, of course, you'll have to declare the global for that variable at the top of the code as well ...

global $scripturl;

echo $scripturl;


ZarPrime
Title: Re: Can reference the forum url from a php block?
Post by: IchBin on May 22, 2012, 09:26:05 PM
Modified ZarPrimes code to reflect how you can echo it out. Hope you don't mind Zar.
Title: Re: Can reference the forum url from a php block?
Post by: ZarPrime on May 23, 2012, 05:20:02 AM
No problem Ichbin. ;) I don't even remember exactly what I posted but I know it wasn't the actual code.  Inge Jones seems quite knowledgeable about php so I figured that it wouldn't be a problem for her to figure it out. :)
Title: Re: Can reference the forum url from a php block?
Post by: Inge Jones on May 23, 2012, 11:44:24 AM
Thanks both :)  While I was waiting I got hold of the link_tree and stripped that down to get the base url, but $scripturl looks a lot more direct :D