Can someone advice me how could I start on redesigning my website. I really don't want to have the default theme(garland). So I started of with the new one of my own for the this website. My problem now is i need to know how I can modify the output of certain blocks.

Eg: $footer, $header and so on

I know by creating different templates for each block we can control. But that is really not helping me at the moment. In my website I want to enable a footer menu, by default drupal only lets a bulleted list. I would like to change it look like a normal footer links separated by a "|". Like wise I would like have a drop menu for all the primary links on top.

There are some modules which lets us work with the menus and stuff but they don't exactly fulfill my requirement.

It would be great if someone can help me.

--
Prasannah

Comments

kannan@kiluvai.com’s picture

Use Devel Module in drupal 6, with the help of theme information shown by the devel module identify template file / theme function for that block / region, duplicate function / template file and rename it and then customize the HTML as per your requirement.

For drop Menu you can use nicemenu which is very poopular and widely used. in that also if you want, you can customise the HTML and CSS read the documentation for that carefully.

if you like to write your own theme function for the menu, you can try it, see the menu functions in the menu module use appropriate function to extract the array and build the HTML as you like through your theme function.

prasannah.ganeshan’s picture

Thanks for the advice on Devel Module for Drupal 6. It's coming in handy.

I don't think Nice Menu will do the job for me. Because It supports only vertical menus. I want to modify the primary links. Is there a way where we can edit nice menu to be displayed horizontally expandable menu.

anbarasan.r’s picture

we can change menu style option under the configuration option of the nice menu block.

anbarasan.r’s picture

All the menu get executed through the following theme callback

theme('links', $footer_links, array('class' => 'links secondary-links'));

The above function will call the following theme function

function theme_links($links, $attributes = array('class' => 'links')) {
  global $language;
  $output = '';

  if (count($links) > 0) {
    $output = '<ul'. drupal_attributes($attributes) .'>';

    $num_links = count($links);
    $i = 1;

    foreach ($links as $key => $link) {
      $class = $key;

      // Add first, last and active classes to the list of links to help out themers.
      if ($i == 1) {
        $class .= ' first';
      }
      if ($i == $num_links) {
        $class .= ' last';
      }
      if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '<front>' && drupal_is_front_page()))
          && (empty($link['language']) || $link['language']->language == $language->language)) {
        $class .= ' active';
      }
      $output .= '<li'. drupal_attributes(array('class' => $class)) .'>';

      if (isset($link['href'])) {
        // Pass in $link as $options, they share the same keys.
        $output .= l($link['title'], $link['href'], $link);
      }
      else if (!empty($link['title'])) {
        // Some links are actually not links, but we wrap these in <span> for adding title and class attributes
        if (empty($link['html'])) {
          $link['title'] = check_plain($link['title']);
        }
        $span_attributes = '';
        if (isset($link['attributes'])) {
          $span_attributes = drupal_attributes($link['attributes']);
        }
        $output .= '<span'. $span_attributes .'>'. $link['title'] .'</span>';
      }

      $i++;
      $output .= "</li>\n";
    }

    $output .= '</ul>';
  }

  return $output;
}

It will return the unordered list so that only you are getting menu in bulleted list format.
so you create your own menu theme function in template.php and call the function.
Eg:

function theme_custom_links($links, $attributes = array('class' => 'links')) {
...
}

then print the menu under the footer region in page.tpl.php like following

  if (!empty($footer_links)):	      
         print theme('custom_links', $footer_links, array('class' => 'links secondary-links'));	
  endif; 
prasannah.ganeshan’s picture

I tried this example, I think I'm doing wrong here it's not working for me the way it should be. Do you think the current theme that I'm using could be a problem why it's not working for me?

I created this function inside the template.php file

function theme_custom_links($links, $attributes = array('class' => 'links')) {
...
}

and used this bit of code to print it in the page.tpl.php file

if (!empty($footer_links)):      
    print theme('custom_links', $footer_links, array('class' => 'links secondary-links'));
endif;

right now I my function looks like this

function theme_custom_links($links, $attributes = array('class' => 'links')) {
  global $language;
  $output = '';

  if (count($links) > 0) {
    $output = '<ul'. drupal_attributes($attributes) .'>';

    $num_links = count($links);
    $i = 1;

    foreach ($links as $key => $link) {
      $class = $key;

      // Add first, last and active classes to the list of links to help out themers.
      if ($i == 1) {
        $class .= ' first';
      }
      if ($i == $num_links) {
        $class .= ' last';
      }
      if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '<front>' && drupal_is_front_page()))
          && (empty($link['language']) || $link['language']->language == $language->language)) {
        $class .= ' active';
      }
      $output .= '<li'. drupal_attributes(array('class' => $class)) .'>';

      if (isset($link['href'])) {
        // Pass in $link as $options, they share the same keys.
        $output .= l($link['title'], $link['href'], $link);
      }
      else if (!empty($link['title'])) {
        // Some links are actually not links, but we wrap these in <span> for adding title and class attributes
        if (empty($link['html'])) {
          $link['title'] = check_plain($link['title']);
        }
        $span_attributes = '';
        if (isset($link['attributes'])) {
          $span_attributes = drupal_attributes($link['attributes']);
        }
        $output .= '<span'. $span_attributes .'>'. $link['title'] .'</span>';
      }

      $i++;
      $output .= "</li>\n";
    }

    $output .= '</ul>';
  }

  return $output;
}

i'm new this whole thing. may be i'm missing something please help me.

Jeff Burnz’s picture

Its not working because the code posted is just an example of the process, but fails to actually make the necessary changes that you require...

What you want can be done with a few lines of CSS ok, no need for extra functions:

#block-id .menu li {
display: inline;
float: left;
list-style:none;
border-right: 1px solid black;
}

#block-id .menu li.last {
border-right: 0;
}

something like that.

prasannah.ganeshan’s picture

thanks for your help. I'm now getting used the drupolly designing :)

Jeff Burnz’s picture