Copyright 2010 osCmax

Different Column Widths

This is for versions of osCMax prior to 2.1 It is assumed that you have done the correct thing and created a new directory structure for your own template.

Press the 'var' button to view source - makes reading the code easier. Also use the copy to clipboard icon beside it, to ease creating new files.

Edit catalog/templates/yourtemplate/mainpage.tpl.php as follows:

Just after the <body> tag - adjust widths to suit your template.

<body>
<?php define('BOX_WIDTH_LEFT', '170px');?>
<?php define('BOX_WIDTH_RIGHT', '150px');?>

Notice BOX_WIDTH_LEFT in the following:

<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
  <tr>
    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH_LEFT; ?>" cellspacing="0" cellpadding="2">
<?php
// Hide Left Column if not to show
if (DOWN_FOR_MAINTENANCE == 'false' or DOWN_FOR_MAINTENANCE_COLUMN_LEFT_OFF =='false') {
?>

<!-- left_navigation //-->
<?php require(bts_select('column', 'column_left.php')); // BTSv1.5 ?>
<!-- left_navigation_eof //-->
<?php
}
?>

Notice BOX_WIDTH_RIGHT in the following

<!-- content_eof //-->
    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH_RIGHT; ?>" cellspacing="0" cellpadding="2">
<?php
// Hide column_left.php if not to show
if (DOWN_FOR_MAINTENANCE == 'false' or DOWN_FOR_MAINTENANCE_COLUMN_RIGHT_OFF =='false') {
?>								
<!-- right_navigation //-->
  <?php require(bts_select('column', 'column_right.php')); // BTSv1.5 ?>
<!-- right_navigation_eof //-->

In the two snippets above, you'll notice the remaining BOX_WIDTH. Strictly speaking these should also be changed but you could use the value to assign a wider overall column width, with left/right boxes smaller - creating a background border, for example.

Save the following as catalog/templates/yourtemplate/column_left.php

<tr><td>
<div class="columnleftdiv">
<table >
<?php
  $column_location = 'Left';
  $column_query = tep_db_query('select configuration_column as cfgcol, configuration_title as cfgtitle, configuration_value as cfgvalue, configuration_key as cfgkey, box_heading from ' . TABLE_THEME_CONFIGURATION . ' order by location');
  while ($column = tep_db_fetch_array($column_query)) {

    $column['cfgtitle'] = str_replace(' ', '_', $column['cfgtitle']);
    $column['cfgtitle'] = str_replace("'", '', $column['cfgtitle']);

    if ( ($column[cfgvalue] == 'yes') && ($column[cfgcol] == 'left')) {
      define($column['cfgkey'],$column['box_heading']);
    if ( file_exists(DIR_WS_BOXES . $column['cfgtitle'] . '.php') ) {
      require(DIR_WS_BOXES . $column['cfgtitle'] . '.php');
      }  
    }
  }
  $column_location = '';
?>
</table>
</div>
</td></tr>

Save the following as catalog/templates/yourtemplate/column_right.php

<tr><td>
<div class="columnrightdiv">
<table >
<?php
  $column_location = 'Right';
  $column_query = tep_db_query('select configuration_column as cfgcol, configuration_title as cfgtitle, configuration_value as cfgvalue, configuration_key as cfgkey, box_heading from ' . TABLE_THEME_CONFIGURATION . ' order by location');
  while ($column = tep_db_fetch_array($column_query)) {

    $column['cfgtitle'] = str_replace(' ', '_', $column['cfgtitle']);
    $column['cfgtitle'] = str_replace("'", '', $column['cfgtitle']);

    if ( ($column[cfgvalue] == 'yes') && ($column[cfgcol] == 'right')) {
      define($column['cfgkey'],$column['box_heading']);
    if ( file_exists(DIR_WS_BOXES . $column['cfgtitle'] . '.php') ) {
      require(DIR_WS_BOXES . $column['cfgtitle'] . '.php');
      }  
    }
  }
  $column_location = '';
?>
</table>
</div>
</td></tr>

Edit catalog/templates/yourtemplate/stylesheet.css with the following - change the values to suit your template:

.columnleftdiv {
border: solid #ffffff 1px;
background-color: #cccccc;
}

.columnrightdiv {
border: solid #ffffff 1px;
background-color: #cccccc;
}

Ridexbuilder 2010/07/28 03:33

  • Bookmark at
  • Bookmark "Different Column Widths" at Digg
  • Bookmark "Different Column Widths" at Furl
  • Bookmark "Different Column Widths" at Reddit
  • Bookmark "Different Column Widths" at Google
  • Bookmark "Different Column Widths" at StumbleUpon
  • Bookmark "Different Column Widths" at Technorati
  • Bookmark "Different Column Widths" at Facebook
  • Bookmark "Different Column Widths" at Twitter
  • Bookmark "Different Column Widths" at Slashdot
column_widths.txt · Last modified: 2010/07/28 02:34 (external edit)
You are here: startcolumn_widths