I have a problem, this is hard to explain so bear with me. I'm building a drupal5.1 theme using zen as the basis.

I have the primary nav laid out as flat list like this " | home | about | contact " using border-left:1px solid #fff as the delimiter, what I want to do is remove the first border.

Normally in a none drupal site, i'll give the first

  • a ".first" class and simply set border:none to remove it, now the question is how can i do this in a drupal template? (other than hard coding the menu, which is a last resort).

    Thanks in advance.

  • Comments

    Anonymous’s picture

    This problem sucks, been there.

    You can try editing your page.tpl.php theme and the $primary_links element (an array) passing it through this. And then put the .first class into the attribute:
    http://api.drupal.org/api/5/function/theme_item_list

    OR, just put a couple spaces and | next to the menu items.

    -G

    blim’s picture

    Thanks. I'll give the first option a go and see how far I get, I don't really want to use a | next to the menu items as the design calls for a much taller delimiter, I'm stubborn enough to hack this until I get it to work!

    Anonymous’s picture

    Actually it was this API theme option I used, http://api.drupal.org/api/5/function/theme_links
    It appends a unique class (based on array key) to each element - so you could style the first one independently.

    print theme_links($primary_links);

    And then your css
    .links .first {
    border-left: none;
    }

    solide-echt’s picture

    As an alternative approach that does not require code changes use CSS.
    There is a (pseudo-) selector in CSS called :first-child. You can use this in your CSS to set .a:first-child to border-left: none (or anything else to your likings). IMHO editing CSS is more failsafe then editing code, even if it is 'just' template scripts.

    blim’s picture

    Thanks folks, it worked!

    I did try the :first-child selector, but because it's not supported properly (if at all) by IE i decided against it.