Hi -
I have a secondary menu set up which appears as a block in a particular region. The block's title is 'csr-secondary'. From what I have read I assume that to override the default block.tpl.php template I should copy it into my theme folder and rename it 'block--csr-secondary.tpl.php' but this is not working!
Can anyone please put me right?
Also, in the past when learning a new open source platform/product I have often advertised for an expert who would be willing to provide a one-to-one tutorial via skype for a fee (via paypal). Sometimes it is just so much more cost effective to pay to have a direct Q/A session when the problems are more conceptual rather than routine. Would this be an appropriate place to place such an advert? If not, where?
Many thanks
Comments
If you've created a custom
If you've created a custom block (for example, with an ID of block-block-1), then the template name should be block--block--1.tpl.php.
thank you for your reply -
thank you for your reply - but how the heck does one find out which block number it is????!!!!
There is nothing apparent in the 'create block' screen of the admin console which lets one know which number the system is providing it..
thanks again..
When you're editing a custom
When you're editing a custom block, the path will be something like '/admin/structure/block/manage/block/12/configure'. For this URL, you would use block--block--12.tpl.php. The number 12 is called the block's delta. You can also view the source of the page where you block appears (or use Firebug to inspect) and look for the ID given to the block.
i tried that -- in the block file name
i tried that -- in the block file name but it's not working , i read in the forum that it's a bug and there's a patch for it
Core bug
See #1021270: Blocks for custom menus are impossible to theme
Drupal 7 block.tpl.php
Hello,
if you are overriding block.tpl.php in drupal 7 use below given format:
block--block--user_register.tpl (use this if block has some name instead of id)
block--block--6.tpl (use this if block has id)
In case block is coming from any module like block from form block module use following format:
block--formblock--user_register.tpl
This has worked for me.
Clear all cache and save the theme after uploading the template.
Thanks
Block.tpl.php drupal 7
This is the default block.tpl.php in drupal 7
/*--------------------default block.tpl.php----------------------*/
Thanks
Problem: Unable to Override the drupal 7 Block
Problem: Unable to Override the drupal 7 Block
Action Done:
I have tried to override the block which has ID "1" and constructed the filename as "block--block--1.tpl.php" and placed in "sites/all/themes/theme-name/templates/block--block--1.tpl.php"
I have placed the following in "page.tpl.php" to check whether block has been customized or not. ( location of page.tpl is "sites/all/themes/theme-name/templates/page.tpl.php"
The Code is:
Thanks, Pixelite!
Pixelite, this helped me a lot. It shouldn't have taken me this long to find this answer! Thank you!
Block.tpl.php for specific regions
I just had an issue with theming specific blocks in a region. what i did to solve is was the following:
1. i added a block.tpl.php which i found from the module/block folder and copied it to my template directory.
2. i then copied the content of the block.tpl.php to an empty file and i renamed that file ex
block--sidebar_second.tpl.php where [sidebar_second] is the name of the region i had given it in my
.info file
3. I then made changes to the new file as i see fit.
4 I cleared all caches.
and it worked.
regions[sidebar_second] = Sidebar second
the catch here is that the naming in d7 is as follows block--[region name as in info file].tpl.php
custom template for custom block module
Greetings all,
So the naming convention for block template files (to override block.tpl.php) is still unclear to me, as I found what seems like unexpected behavior. Any help with my confusion would be greatly appreciated.
I created a custom (coded) block module, but could not get the naming convention to work for the template.
The conventions described above (in this post), and here:
http://drupal.org/node/104319
http://drupal.org/node/1323980
do not appear to work? or don't work for a block module?
The html output for the block's main DIV is:
which does not include my module name. (Is this the convention for custom block modules?)
Also the value of $block->module is:
systemblock-system-main
What eventually worked (after trying a large number of different file names) is:
block--system.tpl.php
Could anyone help explain the naming convention this is following?
And do all block modules have use the same template file then?
Many thanks in advance for any insights. :)
Best
Stuart
Overriding block.tpl.php for views created blocks
For blocks made by views
Here's the html of my block :
The ID is in my example : "block-views-VIEWSNAME-block-1"
And the tpl is : block--views--VIEWSNAME-block-1.tpl.php
Et voilà.
David THOMAS
http://www.smol.org
helpful
thanks for this...exactly what i needed
Lee
Very helpful, that's exactly
Very helpful, that's exactly when I needed..