Hi, I'm completely new to coding in php. I'm stuck with this:
For a Joomla template I need to set up variables, using countModules. This is what I try to do, but I am getting nowhere:
I want to create a three column template, based on the Skeleton CSS Framework.
<div id="left" class="four columns"> <-- left sidebar
<div id="main" class="eight columns"> <-- Joomla component
<div id="right class="four columns"> <-- right sidebar
That's the basic template, with all three columns present. If one sidebar is missing, then "main" has to change from class="eight columns" into class="twelve columns". If both sidebars are missing, "main" has to change to class="sixteen columns".
I understand I have to set up variables first. I give them the value 0.
$left = 0, $right = 0, $main = 0 + ($left + $right)
Then I would use countmodules to count the modules, to get a value. Being 0 (no modules) or 1 (modules present).
If the total = 0, (no sidebars present) $main would be 0, and that should echo "sixteen" columns.
If the total is 1, (1 sidebar present) $main would be 1, giving echo "twelve" columns
If the total is 2, (2 sidebars present) $main would be 2, giving echo "eight" columns.
That's roughly how it should be, I think. But it doesn't work. Can anyone help me to get this working correctly?
Thanks,
Jos