Left and right column
Posted: Wed Sep 26, 2012 3:46 pm
Is there some way that I could determinate if column exists on a particular page?
For example i have this structure:
What i want to do is make content column wider or thiner by adding css class on certain condition.
The condition is if left or right column doesn't exist "do that" etc.
This is how I tried to do this but for some reason it wont work properly:
The second method I tried was using isset() function and the same result.
For example i have this structure:
Code: Select all
<div class="container_24">
<div id="column-left" class="grid_6"></div>
<div id="content" class="grid_12"></div>
<div id="column-right" class="grid_6"></div>
</div>
The condition is if left or right column doesn't exist "do that" etc.
This is how I tried to do this but for some reason it wont work properly:
Code: Select all
<div class="container_24">
<?php echo $column_left; ?>
<div id="content" class="<?php
if($column_left != null && $column_right != null) { echo 'grid_12'; }
if($column_left == null && $column_right != null) { echo 'grid_18'; }
if($column_left != null && $column_right == null) { echo 'grid_18'; }
if($column_left == null && $column_right == null) { echo 'grid_24'; }
?>">
</div>
<?php echo $column_right; ?>
</div>