0

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; ?>
</ul></nav>

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; ?>
</div>

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

<li>image</li>
<li>image</li>
<li>image</li>

and then ends with

</ul></nav>

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">
    <ul>
        <li>[image]</li>
    </ul>
</nav>

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

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. – Matt Apr 23 '15 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 – Colin Shipton Apr 24 '15 at 10:52

Your Answer

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

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