drupaldrupal-6drupal-blocksdrupal-templatesdrupal-navigation

Drupal6: How to programmatically style a block?


In Drupal6, I basically have a block (a hierarchical menu structure) that turns out like this in HTML:

<div class="block block-menu_block" id="block-menu_block-1">
<div class="content">
    <div class="menu-block-1 menu-name-menu-navigation parent-mlid-0 menu-level-1">
    <ul class="menu">
        <li class="leaf first menu-mlid-248 active active-trail"><a class="active-trail active" title="" href="/">Start</a></li>
        <li class="expanded menu-mlid-249 active"><a class="active" title="" href="/">Aktuell</a>
            <ul class="menu">
                <li class="leaf first menu-mlid-259">
                    <a title="News und Presse" href="/news-und-presse">News and Press</a>
                </li>...

What I would like to get is actually a lot simpler:

<div id="topmenu">
    <ul class="one">
    <li>some main entry
        <ul>
        <li>
            some sub entry ...

or maybe:

<div id="topmenu">
    <h2>some main entry</h2>
        <h3><a href="#">some sub entry</a></h3>
        <h3><a href="#">another sub entry</a></h3>
    <h2>another main entry</h2>

So, keeping the structure, but being able to use simpler, even completely different tags, if and when needed. I think I understand from the drupal docs, that I am (maybe) looking at

<div class="block block-menu_block"
id="block-menu_block-1"

==>     module := menu_block
    delta  := 1 (?)

regrettably, none of the suggested

placed next to page.tpl.php (yes, I did clear the cache), has any impact. Even with just a big, shiny HELLO WORLD inside... no luck...

What do I need to override and how? (ideally some sort of recursive function?)

Thank you!


Solution

  • You can control all html output by overriding theme functions and templates in your own custom theme. Read the documentation to learn how: http://drupal.org/node/341628.

    That said: if this really bothers you about Drupal, you may want to save yourself a headache and choose a different CMS/framework. Drupal is designed to produce generic html with enough divs and classes for 95% of the use cases. Clean and minimal html can be accomplished, but it can take a lot of time.