By electronicmonkey on
I have put a background image to the title of the blocks that I am using on the sidebars. However I need to have a new block that I may use in content area which will have no background image in title. How is this possible ?
Comments
Each block is output in a
Each block is output in a div with a unique id. View source, note the id, and style as needed.
Or you can style divs with
Or you can style divs with the class "block" differently in the main content area from the sidebars. That will work too.
I think I may not have made
I think I may not have made myself very clear. When i go to the blocks section in admin and create a new block it will be the default block with the background image in title. However this will not do for the content area , and I will want a block that if I place in the content area will not have the background image in title. I don't know how your solution will work for dynamic blocks.
solution?
the glass is half full or half empty? Try making several blocks with different backgrounds as you like. In the specific visibility settings of the block choose "Show if the following PHP code returns TRUE". Check for arg(0) and make a block only appear for that arg(0) e.g. call a block the content block and choose it to "show" only when the arg(0) is content, call another block the admin block and choose it to "show" when the arg(0) is admin. Reply if this doesn't work.
Ali Hammad Raza
WordsValley
Every block you create in
Every block you create in the admin area will have a unique CSS id applied to it.
Use this to change the way it's styled.
where do i find this unique
where do i find this unique css id for the block ? certainly not in the blocks admin
It's in the HTML source when
It's in the HTML source when you view a page. A block is output something like this:
Use the div id as your css selector, in this example that would be #block-menu-166. You may on occasion have to use div#{whatever} to get everything.
--
Erik
This is what I grabbed from
This is what I grabbed from my source for the particular block :
Now what I had initially done is introduce another div "topblock" inside block.php to accommodate a decorative top border image . All I am trying to do is get "topblock" to display only in sidebars but not in any other position. Am I making more sense now ?
Use different block
Use different block templates by region, as described in the manual page.
Though for a purely decorative border, I'd use CSS with background-image and padding to give it space.
What I have done is create
What I have done is create several new blocks for the border and place them where they are needed. It is not an elegant solution but it meets immediate need.
One big problem though is that I cannot get any padding from the content in blocks whatever I do. The content keep running over the side borders..
www.getfirebug.com ^^^ you
www.getfirebug.com
^^^
you need this
I changed my mind after all
I changed my mind after all and did as the manual instructed - created different block templates for each region like block-content.tpl.php , block-footer.tpl.php etc .
Isn't Drupal marvelous ?
Just as an FYI you should be
Just as an FYI you should be able to do this purely with CSS (depending on your theme). I always start with zen, and to select only the blocks in the content area the selector should be something like:
I've no idea if there's any overhead to many tpl.php files, but philosophically I like to keep things purely css whenever possible. I like to keep tpl.php files to structural or content changes, not style changes (assuming your theme provides enough css classes/ids).
===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime." -- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz