Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow the template class to control the grid layout (report #104)

  • Loading branch information...
commit 679e3dc0d0b6ed1f0e7129dc674d18c1afc3b330 1 parent 40867c6
@haraldpdl haraldpdl authored
View
35 catalog/includes/classes/osc_template.php
@@ -13,11 +13,38 @@
class oscTemplate {
var $_title;
var $_blocks = array();
+ var $_grid_container_width = 24;
+ var $_grid_content_width = 16;
+ var $_grid_column_width = 4;
function oscTemplate() {
$this->_title = TITLE;
}
+ function setGridContainerWidth($width) {
+ $this->_grid_container_width = $width;
+ }
+
+ function getGridContainerWidth() {
+ return $this->_grid_container_width;
+ }
+
+ function setGridContentWidth($width) {
+ $this->_grid_content_width = $width;
+ }
+
+ function getGridContentWidth() {
+ return $this->_grid_content_width;
+ }
+
+ function setGridColumnWidth($width) {
+ $this->_grid_column_width = $width;
+ }
+
+ function getGridColumnWidth() {
+ return $this->_grid_column_width;
+ }
+
function setTitle($title) {
$this->_title = $title;
}
@@ -69,6 +96,14 @@ function buildBlocks() {
}
}
}
+
+ if (!$this->hasBlocks('boxes_column_left')) {
+ $this->_grid_content_width += $this->_grid_column_width;
+ }
+
+ if (!$this->hasBlocks('boxes_column_right')) {
+ $this->_grid_content_width += $this->_grid_column_width;
+ }
}
}
?>
View
18 catalog/includes/template_bottom.php
@@ -13,14 +13,28 @@
</div> <!-- bodyContent //-->
-<div id="columnLeft" class="grid_4 pull_16">
+<?php
+ if ($oscTemplate->hasBlocks('boxes_column_left')) {
+?>
+
+<div id="columnLeft" class="grid_<?php echo $oscTemplate->getGridColumnWidth(); ?> pull_<?php echo $oscTemplate->getGridContentWidth(); ?>">
<?php echo $oscTemplate->getBlocks('boxes_column_left'); ?>
</div>
-<div id="columnRight" class="grid_4">
+<?php
+ }
+
+ if ($oscTemplate->hasBlocks('boxes_column_right')) {
+?>
+
+<div id="columnRight" class="grid_<?php echo $oscTemplate->getGridColumnWidth(); ?>">
<?php echo $oscTemplate->getBlocks('boxes_column_right'); ?>
</div>
+<?php
+ }
+?>
+
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
</div> <!-- bodyWrapper //-->
View
4 catalog/includes/template_top.php
@@ -30,8 +30,8 @@
</head>
<body>
-<div id="bodyWrapper" class="container_24">
+<div id="bodyWrapper" class="container_<?php echo $oscTemplate->getGridContainerWidth(); ?>">
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
-<div id="bodyContent" class="grid_16 push_4">
+<div id="bodyContent" class="grid_<?php echo $oscTemplate->getGridContentWidth(); ?> <?php echo ($oscTemplate->hasBlocks('boxes_column_left') ? 'push_' . $oscTemplate->getGridColumnWidth() : ''); ?>">
Please sign in to comment.
Something went wrong with that request. Please try again.