1

im making a custom theme for drupal, and im having a hard time trying to understand how to adapt one of my themes to drupal 7.

Right now im having an issue because i need to set some classes on all the blocks of a sidebar. i decided to make a block--sidebar.tpl.php file and there i set all the structure of the blocks.

So far so good but now, the block shows up, but im unable to get the title and contents of the block correctly. How can i achieve this?, thank you.

4
  • Did you make your template by copying the default block.tpl.php? because the code in there already shows use of the subject & contents variables.
    – rooby
    Commented Oct 25, 2014 at 8:38
  • Hi, where i can find that default block.tpl.php? :S
    – EgEm
    Commented Oct 25, 2014 at 17:45
  • NVM i just found it...its on modules/block !
    – EgEm
    Commented Oct 25, 2014 at 19:25
  • Also if you are using a subtheme (like zen for example) the template to override may be in there. I suggest reading up on template overriding drupal.org/node/173880
    – rooby
    Commented Oct 26, 2014 at 5:45

1 Answer 1

0

A different approach would be to:

  1. Use the Block Class module - which will also allow you to add more classes per block.
  2. Use CSS to apply the same styling to all blocks in the sidebar:

    .sidebar .block { border: 1px solid #ccc} .sidebar .block-title {color: blue}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.