Thank you so much for this module.

I'm having a strange problem when I include more than 21 custom settings.

I have 33 custom settings in my new theme. They all work in FF. However in IE (including both IE6 and IE7) they all work ONLY if I remove 12 of the CSS include lines in my template.php. Any combination of them, up to 21 and everything works fine. Any more than 21 and the CSS includes still work, BUT any CSS inserted inline in the page.tpl.php header stops working in IE. This same inline CSS DOES continue to work in FF.

Here is an example of the CSS Include lines I am referring to in template.php:

drupal_add_css(drupal_get_path('theme', 'denver') . '/css/' . $centerbg . '.css', 'theme');

BELOW IS ALL THE CODE:

Here is the code I'm using in theme-settings.php:

    'denver_centerbg' => '',
	'denver_customcenterbg' => '',

  $settings = array_merge($defaults, $settings);
  $form['denver_centerbg'] = array(
    '#type' => 'select',
    '#title' => t('Center Column Background'),
    '#default_value' => $settings['denver_centerbg'],
    '#options' => array(
      'centerbg-trans' => t('Transparent (default)'),
      'centerbg-white' => t('White'),
      'centerbg-lightgray' => t('Light Gray'),
      'centerbg-gray' => t('Gray'),
      'centerbg-black' => t('Black'),
      'centerbg-custom' => t('Custom Center Column Background'),
    ),
  );

  $form['denver_customcenterbg'] = array(
    '#type' => 'textfield',
    '#title' => t('Custom Center Column Background'),
    '#default_value' => $settings['denver_customcenterbg'],
    '#size' => 40,
    '#maxlength' => 100,
  );

Here is the code I'm using in template.php:

'denver_centerbg' => 'centerbg-trans',
'denver_customcenterbg' => '',

$centerbg = theme_get_setting('denver_centerbg');
if (!$centerbg)
{
   $centerbg = '';
}

drupal_add_css(drupal_get_path('theme', 'denver') . '/css/' . $centerbg . '.css', 'theme');

Here is the code I'm using in page.tpl.php:

<?php 
$centerbg = theme_get_setting('denver_centerbg');
if (!$centerbg)
{
   $centerbg = '';
}
 ?>

   <?php if ($centerbg=='centerbg-custom'):?>
      	#center {background : <?php print theme_get_setting('denver_customcenterbg') ?>;}
   <?php endif; ?>

Comments

colorado’s picture

[b]OK, here's how I solved the problem:[/b]

Apparently IE (all versions) just chokes on loading so many stylesheets. I have 35 settings in my theme settings, each inserting a .css file into the head - that's 35 .css files, although the vast majority of them only contain a few lines.

I just enabled the [b]CSS Aggregator[/b] in admin/settings/performance and everything is working perfectly now. You can find that setting at the bottom of the admin menu under [b]Administer -> Site Configuration -> Performance[/b] (at the bottom of the page) -> Aggregate and compress CSS files:

Set it to [b]enabled[/b] to make your drupal sites run faster, especially if you are loading a lot of stylesheets, and to prevent IE rendering errors.

Sigh...

colorado’s picture

Assigned: Unassigned » colorado
Category: bug » support
Priority: Critical » Minor
Status: Active » Closed (fixed)

OK, here's what I discovered:

Apparently IE (all versions) just chokes on loading so many stylesheets. I have 35 settings in my theme settings, each inserting a .css file into the head - that's 35 .css files, although the vast majority of them only contain a few lines.

I just enabled the CSS Aggregator in admin/settings/performance and everything is working perfectly now. You can find that setting at the bottom of the admin menu under Administer -> Site Configuration -> Performance (at the bottom of the page) -> Aggregate and compress CSS files:

Set it to enabled to make your drupal sites run faster, especially if you are loading a lot of stylesheets, and to prevent IE rendering errors.

Sigh...

johnalbin’s picture

Alternatively, you could use the settings to toggle different class names in your page.tpl.php file and only have 1 CSS file. (Rather than 35 CSS files.)