Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I'm working on some custom templates for a page created by Views and I'm struggling to understand why it's using block.tpl (which I thought was used for blocks). Basically I'm trying to get rid of all the extra divs created for just this one particular page, and until I remove the div class content I can't get the desired style I'm looking for.

I did something similar for a block generated by views and used the template name block--view-name.tpl and got the desired effect. I ended up copying that same template file and just called it block.tpl and got the deserved effect on this Views page.

Now I'm left scratching my head as to why this Views page is listening to block.tpl when it's not a block. Also, seeing as it apparently wants a block template to do what I want, I'm trying to figure out the template naming but none of the usual tools are helping (theme developer module, the theme information under the advanced tab when editing the view).

Does anyone know why a page generated by views would be listening to block.tpl? If it helps the view content on the page is being wrapped by the following div:

<div id="block-system-main" class="class="block block-system"></div>
share|improve this question
add comment

2 Answers 2

That block is the main content block.

<div id="block-system-main" class="class="block block-system"></div>

It is provided by the system module and is the default content area block in the page template.

More information:

  1. system_block_info ( delta is "main" )
  2. system_block_view
share|improve this answer
    
Ah I see, well that at least clears up the first part. Do you know how I would go about figuring out naming a custom block template for that page? The theming information provided by the View settings doesn't offer any suggestion for a block template and I've tried every possible name I can think of. –  Brad Chesterfield Jan 18 '13 at 16:40
add comment

In Drupal 7 the main page content was turned into a block that could be positioned with the block module. Problem is I don't think people have many use cases for that functionality.

You can get rid of that ugly #block-system-main div by doing the following:

  1. Add a template to your theme called block--system--main.tpl.php

  2. Print ONLY the content within that block template: <?php print $content; ?>

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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