Joomla 2.5 Templates - $showRightColumn
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'));
- 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.
- 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 Code||The results|
// check modules
‹Section 1: Joomla 2.5 Templates - defined('_JEXEC') or die
›Section 3: Joomla 2.5 Templates - $this->countModules('position-3')
Joomla Community Google+ Hangout #3
June 3rd, 2014
Thank you @RustyJoomla for letting me speak on the Joomla Community Google+ Hangout!