I added this in mytemplate.info

regions[new_part] = "New Part"

And this in page.tpl.php

if ($new_part):

print $new_part

endif;

Now, I want to customize this region on block going into this region. How to identify the block I created using $block->delta in block.tpl.php. Or is there another way? because I am trying to create a new block and add it in the new region but I cannot customize this new block. I need a way to identify it in block.tpl.php so I can have customized code.

Thanks

Comments

cohq82’s picture

Sorry the second code here:

	<?php if ($new_part): ?>
		<div id="new_part">
			<?php print $new_part ?>
		</div>
	<?php endif; ?>

yuriy.babenko’s picture

Create the file block-[DELTA].tpl.php and Drupal will use that file for that particular block.
It's basic templating :)
See http://yubastudios.com/blog/drupal-extending-templating for more examples of what you can do.

---
Yuriy Babenko
www.yubastudios.com
My Drupal tutorials: http://yubastudios.com/blog/tag/tutorials

---
Yuriy Babenko | Technical Consultant & Senior Developer
http://yuriybabenko.com

cohq82’s picture

How to find out what [DELTA] is for that block?

yuriy.babenko’s picture

Go to the blocks administration page and hover over the link to configure the block. You will see the block's delta in the status bar of your browser as part of the URL. In 99% of the cases it will be an integer.
---
Yuriy Babenko
www.yubastudios.com
My Drupal tutorials: http://yubastudios.com/blog/tag/tutorials

---
Yuriy Babenko | Technical Consultant & Senior Developer
http://yuriybabenko.com

cohq82’s picture

Then I am confused because it showed block/7 so I create block-7.tpl.php but it didn't got used by Drupal. Any hint?

yuriy.babenko’s picture

I'm assuming you read the part of the tutorial which talks about clearing the theme registry after creating new template files?
---
Yuriy Babenko
www.yubastudios.com
My Drupal tutorials: http://yubastudios.com/blog/tag/tutorials

---
Yuriy Babenko | Technical Consultant & Senior Developer
http://yuriybabenko.com

cohq82’s picture

Yes, I did clear the cache! Still ... hmm

cohq82’s picture

Any way to troubleshot this?