Joomla 2.5 Templates – $showRightColumn

Joomla 2.5 has reached its end of life as for 12/31/2014. Please be advised this may be a security risk to your website. You can view more information about the end of life here.

As we continue to review the code in the Beez2 template, we come across the following code:

// check modules
$showRightColumn        = ($this->countModules(‘position-3’) or $this->countModules(‘position-6’) or $this->countModules(‘position-8’));

  1. Based upon the name of the variable, showRightColumn, it appears the template is trying to figure out whether or not to show the right column of the template.
  2. Based upon the function called, countModules, it would appear that showRightColumn is going to be the value of how many modules are shown in each of the listed positions.

Before testing further, we will assume that if neither position-3, position-6, or position-8 have any modules being loaded, then showRightColumn will have a value of 0. Because it has a value of 0, the template would not show the right column.

What is the value of $showRightColumn?

At this point in our testing, we have:

  • 2 modules loaded in position-3
  • 1 module being loaded in position-6

When we make an adjustment to the template file to show the value of $showRightColumn, we see the value is 1. This means that showRightColumn is not the count of modules being shown, but whether any modules are shown in the list of positions. If there are no modules being loaded, then the value will be 0. Otherwise, the value will be 1 if there are any modules being loaded.

Our Testing CodeThe results

// check modules
$showRightColumn        = ($this->countModules(‘position-3’) or $this->countModules(‘position-6’) or $this->countModules(‘position-8’));
echo “showRightColumn = $showRightColumn”; die();


Was this article helpful? Let us know!