TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,966
  • Latest: safir45
Stats
  • Total Posts: 195,994
  • Total Topics: 21,325
  • Online today: 777
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 1
  • Guests: 89
  • Total: 90
  • @rjen

Can reference the forum url from a php block?

Started by Inge Jones, May 22, 2012, 12:56:48 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Inge Jones

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?

ZarPrime

#1
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

IchBin

Modified ZarPrimes code to reflect how you can echo it out. Hope you don't mind Zar.

ZarPrime

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. :)

Inge Jones

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

This website is proudly hosted on Crocweb Cloud Website Hosting.