Table of Contents
We are continuing to review Joomla 2.5’s Beez2 template code, and we next come accross the following code:
In our review thus far, we have alread seen instances of $this->, for example:
What is $this-> ?
Technically speaking, in PHP $this refers to the current object. PHP will set the contents of $this when you are inside a function of an object.
If we update our template’s code as follows, we can see more information about $this:
The output above is quite long, and below we’ve included the first few lines only:
Based upon the first line, $this appears to be referring to the JDocumentHTML Object, which we touched based on in a previous article.
When is $this-> used in the Beez2 template?
When scanning the index.php file of the Beez2 template, there are several uses of $this: