[support] Block Styles

Tom Holmes Jr. tom at tomholmes.net
Thu Dec 27 18:04:02 UTC 2007


Bill Fitzgerald wrote:
> Hello, Tom,
>
> If I understand your question correctly, you have done the following steps:
>
> 1. Created the menus at the menu admin screen.
>
> 2. Displayed those menus in a region of your theme via the block config 
> menu --
>   
Yes, and yes .... nothing special there ....
> If this is the case, every block has a unique ID, and you could target 
> individual blocks via css. Alternately, and this would be more complex 
> but ultimately more flexible, you could set up a php snippet in your 
> template.php (or maybe even create a small helper module) that examined 
> block titles, and then applied css based on the text of the title.
>
> In some ways, the second option could be pretty slick: an admin screen 
> where you identified the text to look for in the block title, and then a 
> textarea where you entered the css override. But that would be a fair 
> amount of work to accomplish something you can do pretty quickly within 
> the stylesheet.
>   
I'll stick to the more simple solution of css for now ... how do I 
figure out the unique id of the block though.
I'm guessing within the block.tpl.php is where I would put this css 
data?  That would be fine with me.
It's too bad I can't create a block-menu_name.tpl.php, that would be 
much simpler and would seem to keep in line with the other standards of 
Drupal.
According to the Pro Drupal Development book on Page 120, we can do:
block-modulename-delta.tpl.php
block-modulename.tpl.php
block-region.tpl.php

Not sure what the 'modulename' is though.
> You also might want to check this out: http://drupal.org/node/74481 -- 
> it's a bit dated, but is still pretty relevant.
>   
Ok, thanks!   I will definitely take a look.
> Also, what I'm suggesting assumes that you are displaying your menus via blocks.
>   
Yep ... that is what I am doing.   I figure it is the BEST way to do 
this since I do have hierarchical menus.
I did create one TEST block with just grabbing, cutting/pasting some 
HTML (and javascript) code into a block,
but that didn't work out so well for my menus.  
I think it would be best to use the Menu System rather than create 
blocks with HTML.

Thanks again for the help!
                                                                    Tom
> Cheers,
>
> Bill
>
> Tom Holmes Jr. wrote:
>   
>> Thanks for the help with login page.   I am working on that now, and 
>> that seems to be going ok.
>>
>> Now, I am working on the Menu System, and I have created some new menus.  
>>
>> This is probably a very easy question ... but for different menus, I'd 
>> like to have different styles for different menu names.
>> Along that line ... I'd like to have different styles for different blocks.
>>
>> I am going through on how to make themes, and I am looking online and 
>> through my book "Pro Drupal Development"
>>
>> I may find my answer soon, but if anyone wants to point me to the right 
>> direction, that would be great!
>>
>> Thanks!
>>                                  Tom
>>   
>>     
>
>
>   



More information about the support mailing list