Joomla 2.5 Templates – $this-> Updated on August 16, 2021 by Brad Markle 1 Minutes, 25 Seconds to Read We are continuing to review Joomla 2.5’s Beez2 template code, and we next come accross the following code: <html xmlns="https://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>" > In our review thus far, we have alread seen instances of $this->, for example: $showRightColumn $this->countModules $this->params->get 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: <? echo "<pre>"; print_r($this); echo "</pre>"; die(); ?> <html xmlns="https://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>" > The output above is quite long, and below we’ve included the first few lines only: JDocumentHTML Object ( [_links] => Array ( [/joomla25/index.php?format=feed&type=rss] => Array ( [relation] => alternate [relType] => rel [attribs] => Array ( [type] => application/rss+xml [title] => RSS 2.0 ) 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: $this->countModules() $this->params->get() $this->baseurl $this->template $this->language $this->direction Share this Article Related Articles How to Use the Free Mini Frontpage Extension for Joomla 4.0 How to Change a Joomla 2.5 User’s Email Address How to Configure Joomla 2.5 to Send Email Using SMTP How to Edit a Joomla 3 Template How to install Phoca Gallery for Joomla 2.5 Creating a Menu Item for your Joomla 3 Component Changing Email Settings in Joomla 3.1 Using the Redirect Manager in Joomla 3.1 How to add Bootstrap to a Joomla 3.1 Template How to Use Bootstrap 5.0 Alerts in Joomla 4.0