Override #Drupal Views Created Blocks Template

Post by: bingorabbit
Published on March 5th, 2013
Filed under: Drupal,information.technology
Tags: , , , ,

I have been looking for this for some time, and when I found it I decided to share it here since one may search for it later.

Sometimes you create a block using the Views module and you need to customize the template of this block, to show in a dropdown manner or something. When the block is first normally rendered it shows mostly like this:

<section id="block-views-VIEWSNAME-block-1">
<h2>My block title</h2>
<div><div>[... SOME CODE ...]</div></div>
</section>

To create a template for this block only, you create a new file named

block–views–VIEWSNAME-block-1.tpl.php

and place it in your theme directory and remove the cache and voila! you are there.

Resource

Leave a Reply