In working on a new template, I ran across this same question and uncovered this encouraging, though currently fairly unhelpful, thread. However, I did take people's queues and gave the Template category in the Joomla! Documentation wiki a shot. One of the articles I discovered was this one:How are templates executed?
According to that article,
Templates are executed in the context of the document object so that the $this object is always the instantiation of the JDocument class.
Ahah, I thought, all I need to do now is check the variables and methods of the JDocument class in the joomla API (JDocument Class
), and I'll have a nice list of variables and methods available through the $this
object from within a template index.php file.
While those would seem to be usable variables and methods, I also noticed that it doesn't mention the ubiquitous $baseurl
variable that every template uses to link to stylesheets and images and the like. As it turns out, that variable is assigned in the render() method of the JDocumentHTML class (around line 217 of /libraries/joomla/document/html/html.php), which is the method responsible for "Outputting the template to the browser." In that method, the $this->template
variable (the name of the directory containing the current template) and the $this->baseurl
variable are both assigned, as well as a $this->params
object, which is generated from the params.ini file of your current template.
So, the full list? Well, if you want to mess with methods, I suggested reading up on the JDocument Class on your own and trying to figure them out, but the list of variables (accessible from the $this object) is as follows, as far as I can tell (all are strings, unless otherwise noted):
$this->params; // Template specific params object -- defined in the params.ini file
// From JDocument:
$this->base; // Document base URL -- redundant, as far as I can tell
$this->description; // Document description
$this->direction; // Contains the document direction setting (default='ltr')
$this->language; // Contains the document language setting (default='en-gb')
$this->link; // Document full URL
$this->title; // Document title
$this->_generator; // Document generator (default='Joomla! 1.5 - Open Source Content Management')
Disclaimer: I have only actually ever used $this->baseurl
, and $this->language
(very useful for developing a multi-lingual site), so I can't vouch for how the others will behave. If anyone else feels like sharing their experiences, please do so!