is it safe to remove <?php print $classes; ?> ?

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
lizac's picture

hi guys.. hope is well.. I just want to ask..

is it safe to remove

<?php
print $classes;
?>
in block.tpl.php. I'm actually maintaining a Drupal site which I think created using Zen. I'm doing some HTML validation using the CSE Validation tool and it gave me this error

The "class" attribute has an empty or missing attribute value. The expected value is one of the following: an

alphanumeric string or a string.

<div id="block-black_theme_support-8" class=""><div class="block-inner">

PHP code in block.tpl.php
<div id="block-<?php print $block->module . '-' . $block->delta; ?>" class="<?php print $classes; ?> simple_box"><div class="block-inner">

tracing where is the class="', I found it in block.tpl.php with this definition

    • $classes: A set of CSS classes for the DIV wrapping the block.
      Possible values are: block-MODULE, region-odd, region-even, odd, even,
      region-count-X, and count-X.

so what do you think? As you know... I'm a noob..

Thanks guys!!!

Comments

Not a good idea

killer_tilapia's picture

Removing the $classes variable doesn't really break your Drupal site but it seriously hampers your efforts to theme. For example: you wanted to do zebra-stripe thing with your blocks - blue backgrounds for odd blocks and green backgrounds for even blocks. How are you supposed write CSS rules for that if you remove the $classes variable from the theme template?

I would rather just leave it on the theme template - it doesn't do anything if there are not CSS rules attached to it but added flexibility when you need it.

You are right...

lizac's picture

Thanks Jaypax! I just retained $classes

Philippines

Group organizers

Group categories

Post category

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: