I'm trying to change the HTML output of the Drupal 7 core main menu block.

I'm using a template file named block--system--main-menu.tpl.php which is overriding it correctly.

Im trying to get the following output but not having any success.

<sidebar id='sidebar1' layout='nodisplay'> <ul> <li> Nav item 1</li> <li> Nav item 2</li> <li> Nav item 3</li> <li> Nav item 4</li> <li> Nav item 5</li> <li close"> Close</li> </ul> </sidebar>

Here is what I am currently using in my "block--system--main-menu.tpl.php" file.

<sidebar id="sidebar1" layout="nodisplay" side="left"> <?php print $content; ?> </sidebar>

With this i'm just getting the standard drupal 7 menu output. I need to be able to control the HTML that is output from the template.

  • What's the output? How does your template look like? – Joseph May 22 '17 at 19:30
  • @JosephtheDreamer Hey thanks for replying, I just added more detail to the question. I have added the contents of my custom template file. – Samp May 22 '17 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.