Conditional Check
I am trying to make a conditional code dependent on if the user has the
left or right bar disabled. I have the following
<?php
$left_sidebar = 'off';
$right_sidebar = 'on';
if ($left_sidebar == 'on' || $right_sidebar == 'on') {
$left_sidebar_width = 'four_columns';
$right_sidebar_width = 'four_columns';
$center_width = 'eight_columns';
} else if ($left_sidebar == 'on' || $right_sidebar == 'off') {
$left_sidebar_width = 'four_columns';
$right_sidebar_width = 'disabled';
$center_width = 'twelve_columns';
} else if ($left_sidebar == 'off' || $right_sidebar == 'on') {
$left_sidebar_width = 'disabled';
$right_sidebar_width = 'four_columns';
$center_width = 'twelve_columns';
} else {
$left_sidebar_width = 'disabled';
$right_sidebar_width = 'disabled';
$center_width = 'sixteen_columns';
}
echo $left_sidebar_width;
echo '<br />';
echo $right_sidebar_width;
echo '<br />';
echo $center_width;
echo '<br />';
?>
The problem I have is no matter what I change $left_sidebar or
$right_sidebar to it always says
four_columns
four_columns
eight_columns
What am I doing wrong that makes it not change when I turn one of the
sidebars to off?
No comments:
Post a Comment