I created a grid with over 100 columns and things broke. Looking at the code, I realized that it would only work when there are 10 to 99 columns / grids defined, as there was a few calls to substr($name, 4, 2) to pull out this.

The following code uses explode('-', $name) to bypass this issue.

Sorry, the CVS server is not creating a valid patch, so I'm just pasting the code in.

fusion/fusion_core/template.php

<?php
// $Id: template.php,v 1.1.2.9 2010/07/04 22:34:29 sociotech Exp $

### line 37
  // Set grid info & row widths
-  $grid_name = substr(theme_get_setting('theme_grid'), 0, 7);
-  $grid_type = substr(theme_get_setting('theme_grid'), 7);
-  $grid_width = (int)substr($grid_name, 4, 2);
+  list($grid_name, $grid_type) = explode('-', theme_get_setting('theme_grid'));
+  $grid_width = (int)substr($grid_name, 4);
+  $grid_name .= '-';

### line 243
  // Initialize block region grid info once per page
  if (!isset($regions)) {
-    $grid_name = substr(theme_get_setting('theme_grid'), 0, 7);
-    $grid_width = (int)substr($grid_name, 4, 2);
-    $grid_fixed = (substr(theme_get_setting('theme_grid'), 7) != 'fluid') ? 1 : 0;
+    list($grid_name, $grid_type) = explode('-', theme_get_setting('theme_grid'));
+    $grid_width = (int)substr($grid_name, 4);
+    $grid_name .= '-';
+    $grid_fixed = ($grid_type != 'fluid') ? 1 : 0;
?>

fusion/fusion_core/theme-settings.php

<?php
// $Id: theme-settings.php,v 1.1.2.6 2010/04/08 07:02:59 sociotech Exp $

## line 127
  // Generate grid type options
  $grid_options = array();
  if (isset($info_theme_settings['theme_grid_options'])) {
    foreach ($info_theme_settings['theme_grid_options'] as $grid_option) {
      $grid_type = (substr($grid_option, 7) == 'fluid') ? t('fluid grid') : t('fixed grid') . ' [' . substr($grid_option, 7) . 'px]';
      $grid_options[$grid_option] = (int)substr($grid_option, 4, 2) . t(' column ') . $grid_type;
    }
  }

// ---- changes to
  // Generate grid type options
  $grid_options = array();
  if (isset($info_theme_settings['theme_grid_options'])) {
    foreach ($info_theme_settings['theme_grid_options'] as $grid_option) {
      list($grid_name, $grid_type) = explode('-', $grid_option);
      $grid_width = (int) substr($grid_name, 4);

      $grid_type = ($grid_type == 'fluid') ? t('fluid grid') : t('fixed grid') . ' [' . $grid_type . 'px]';
      $grid_options[$grid_option] = $grid_width . t(' column ') . $grid_type;
    }
  }

## line 167
  // Calculate sidebar width options
-  $grid_width = (int)substr($settings['theme_grid'], 4, 2);
-  $grid_type = substr($settings['theme_grid'], 7);
+  list($grid_name, $grid_type) = explode('-', $settings['theme_grid']);
+  $grid_width = (int) substr($grid_name, 4);

?>

The rather large style sheet & ini file segment area attached for testing, but creating a 2 or 3 grid array will also break the logic in the code.

Cheers
Alan

Comments

alan d.’s picture

StatusFileSize
new3.59 KB

PS: I'm totally new to the project, so this needs so experienced eyes on it.

I've created a patch against the themes folder in the project using SVN to show the above modifications better, but this can not be applied to the checked out theme from Drupal CVS.

alan d.’s picture

Title: Invalid assumations when parsing grid name, width, etc » No support for grid counts under 10 or over 99.
Priority: Major » Critical

Bumping to critical as this seems to have been ignored and with grids <10 & >99, the entire theme is unusable.

jeremycaldwell’s picture

Assigned: Unassigned » sociotech
stephthegeek’s picture

Assigned: sociotech » aquariumtap
aquariumtap’s picture

Assigned: aquariumtap » Unassigned

Status: Needs review » Needs work

The last submitted patch, unlimited-columns.patch, failed testing.

Poieo’s picture

Status: Needs work » Closed (won't fix)

Closing as won't fix since the D6 version is getting no new development.

alan d.’s picture

Without using Fusion since this particular site (2010), doesn't this code (from 7.x-2.x branch) do the same thing?

  } else {
    $grid['name'] = substr(theme_get_setting('theme_grid'), 0, 7);
    $grid['type'] = substr(theme_get_setting('theme_grid'), 7);
    $grid['fixed'] = (substr(theme_get_setting('theme_grid'), 7) != 'fluid') ? TRUE : FALSE;
    $grid['width'] = (int)substr($grid['name'], 4, 2);
  }
Poieo’s picture

Version: 6.x-1.x-dev » 7.x-2.x-dev
Priority: Critical » Normal
Status: Closed (won't fix) » Needs work

Changing to a possible issue for the 7.x-2.x branch, however it is not critical.

Thanks for taking the time to look into this again.

Poieo’s picture

Poieo’s picture

Status: Needs work » Postponed
Issue tags: +7.x-3.x

Postponing this to the 7.x-3.x version.