UPDATE: Colin is right but I'd like to go over what I did to accomplish this. I added a views-view.tpl.php template and where it said

<?php print $rows; ?>

I wrapped it like this

<nav id="menu"><ul>
    <?php print $rows; ?>

I also wanted to prevent each row from being wrapped in a view so I also added a views-view-unformatted.tpl.php template and replaced

<div<?php if ($classes_array[$id]) { print ' class="' . $classes_array[$id] .'"';  } ?>>
    <?php print $row; ?>

with just

<?php print $row; ?>

I'm trying to have a view that starts with a

<nav id="menu"><ul>

then contains all the content of my view like so


and then ends with


However I'm having a lot of trouble. Header and footer does not work because it starts and closes it in it's own div. I tried hiding all the contents and doing a global text field like so

<nav id="menu">

However that gives each item it's own nav and closes it right after each one.

Is wrapping the entire comments in the and tags possible in drupal?

1 Answer 1


You will need to add a View template to your theme, take a look at Views template files to give you an idea of how to accomplish this

  • That worked. But is there a way to make it so it only applies to a specific type of view? I don't want this to affect all of my views.
    – Amy
    Commented Apr 23, 2015 at 13:54
  • Whichever file you have overridden add the view name prefixed with -- before the .tpl.php so forexample if your view name was nav and you overrode views-view.tpl.php your file would be views-view--nav.tpl.php Commented Apr 24, 2015 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.