12

I am new to drupal 7 and really struggling with this one:

http://drupal.org/node/104319

I have a region called navigation

in my .info regions[navigation] = Navigation bar

for this region I want to use a custom tpl.php file. I have tried

  block-navigation.tpl.php

like in the example, and put it at the theme root and in the templates folder with no luck. I've cleared the cache and insured that a standard working block.tpl.php is in place. To no avail.

ANSWER:

I needed BOTH a region--navigation.tpl.php AND a block--navigation.tpl.php with a double -- both times.

1000 views on this question earned me the popular question badge. But you guys can't find it in your heart to upvote it more than 1 time. Laaaammmmmeeee....

4
  • Regions are for different Blocks, Try creating same block with different theme. Add visibility configuration using page arguments.
    – niksmac
    Apr 18, 2012 at 4:06
  • So its not be region but by the block itself? Apr 18, 2012 at 4:08
  • Yeah. But lets wait some minutes for other solutions.
    – niksmac
    Apr 18, 2012 at 4:08
  • here we go, +1 :) Jan 7, 2013 at 11:44

1 Answer 1

4

To use a custom tpl.php file for "navigation" region, you should use region--navigation.tpl.php

6
  • Dang it. It need to be the block. Its main menu if that helps. Apr 18, 2012 at 4:47
  • If you need to use "block-navigation.tpl.php", you should also have a custom block.tpl.php for your theme. See this(drupal.org/node/104319) for more details.
    – Varshith
    Apr 18, 2012 at 4:59
  • 1
    That documentation page is for Drupal 5. drupal.org/node/1089656 is the appropriate documentation page for Drupal 7. The relevant naming pattern is block--[region].tpl.php and the generic template (block.tpl.php) is no longer needed in D7 in order to use a specific template (block--[region].tpl.php).
    – sheena_d
    Apr 18, 2012 at 8:03
  • After looking at "block-navigation.tpl.php" in the question, I was misled. Sorry, for the confusion I caused. ty sheena
    – Varshith
    Apr 18, 2012 at 11:29
  • All good. I am just here to learn ;) Apr 19, 2012 at 5:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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