Hi to all!
I've got a trouble: I don't understand how menu output in Drupal 7 can be rewritten?
The standard menu code is like this:

<ul class = "menu">
    <li class = "first leaf"><a href = "#"> link 1</a></li>
    <li class = "leaf"><a href = "#">link 2</a></li>
     ...
   <li class = "last leaf"><a href = "#">link n</a></li>
</ul>

...but I need to do something like that:

<ul class = "menu">
    <li class = "separator">
    <li class = "first leaf"><a href = "#"> link 1</a></li>
    <li class = "separator">
    <li class = "leaf"><a href = "#">link 2</a></li>
     ...
   <li class = "last leaf"><a href = "#">link n</a></li>
</ul>

it mens, add <li class = "separator"> to menu. How to do it? Please, help, I really need it!

Comments

Hey there,First of all, the

Hey there,

First of all, the html code you want there is wrong, as you don't have any closing tags for the separator class <li>.

If you want separators or NOLINK menu items, try the Special Menu Items module.

You can follow me on Twitter: @drupalexp or on my blog.

Yes, I know that there are no closing tags

Yes, I know that there are no closing tags
"

", it is just fast example of what I whant to see as output html code.
But I need to write a theme for drupal 7 and whant to rewrite some Drupal's functions, but don't know how.

---

Drupal is written in PHP, and the first thing I would do is check out the page.tpl.php file of a working theme and check out the menu code. They print out in an array, and you'd be able to echo out one menu item, then a separator, then the next menu item, etc.

Yes, Look into the API for

Yes,

Look into the API for ways you can overwrite the menu output in the theme's template.php file.

You can follow me on Twitter: @drupalexp or on my blog.

If all you need is to add a

If all you need is to add a specific style to a menu list, like that separator, the easiest way is to use pseudo selectors like :before. You will also have a cleaner HTML. There is an example combined with CSS content property.

love, light n laughter

nobody click here