Most operating systems and website browsers are not familiar with the majority of fonts that are out there. As a designer (moreso then a developer) I am tired of using the same 4 or 5 fonts to stylize my websites. I can only assume that I am not alone!

Yesterday, I started to attack the template.php file. I customized the phptemplate_links function to pass the menu titles to an external php script that renders the text as a jpeg. Although I can't change the font of every element on the website (performance reasons); I am now able to use ANY truetype font that I want for the menus, headers and misc elements of the site. It's beautiful in practice.

However, I'm currently boggled by what's going on within that function! How can I create a if statement that checks to see if the current menu item being outputted is a primary_link, or a secondary_link? I've managed to differentiate 'active' and 'inactive' menu items.

Also, once I'm satisfied with the output, I will be releasing a tutorial and code snippets for general use. I'm confident that it will be a welcomed addition to the Drupal community.

Comments

pbarnett’s picture

...as the primary and secondary links are dealt with seperately there.

Pete.

mxgfx’s picture

Once again, the #drupal room on Freenode has been very helpful.

The solution was to create two separate functions for each link type (primary and secondary links). Because I was originally using one function handle all of the menu items, I was restricting the flexibility of it's usage. When the page.tpl calls a print function, it looks directly into the template.php file.

Joanzo’s picture

can you post the tutorial on this, cause i'm having the same problem here,
i try using this, menu likes on this thread
http://zugec.com/drupal/using-css-tab-designer-with-zen-theme

and add extra php on template.php

function zen_links($links) {
  if (!count($links)) {
    return '';
  }
  $level_tmp = explode('-', key($links));
  $level = $level_tmp[0];
  $output = "<ul class=\"links-$level\">\n";
  foreach ($links as $index => $link) {
    $output .= '<li';
    if (stristr($index, 'active')) {
      $output .= ' class="active"';
    }
    $output .= ">". l($link['title'], $link['href'], $link['attributes'], $link['query'], $link['fragment']) ."</li>\n";
  }
  $output .= '</ul>';
 
  return $output;
}

but, the result is it affect the other ul and li list items style,
how can i solve this only using this as primary menu ?

thanks