How to surround a Drupal view with some tags?
Let's say I have a view that returns some items. I want to display the items in an unordered list, so I rewrite the field output with <li>[field]</li>开发者_运维技巧;
. Now I only have to surround the view with <ul>
and </ul>
tags.
However, when I add those tags as "full HTML" to the view's header and footer areas, they are being surrounded by a div
like so:
<div class="view-header">
<ul>
</div>
which kinda defeats the purpose, as the UL tag is ignored by some Browsers / jQuery versions.
How can I get rid of the div
s around the <ul>
?
For your concrete need, you can save yourself the trouble of overriding templates and just configure the view directly to use the style 'HTML List', with list type 'Unordered list'. (On the views configuration page, under 'Basic settings').
The answer is to override views-view.tpl.php
so that instead of producing div
s it only produces ul
s. Alright. Now I only have to find a template for views-view-fields.tpl.php
to override that as well.
精彩评论