如何用一些标签包围 Drupal 视图?
假设我有一个返回一些项目的视图。我想以无序列表的形式显示项目,因此我用
重写了字段输出。现在我只需要用
和
但是,当我将这些标签作为“完整 HTML”添加到视图的页眉和页脚区域时,它们被 div
包围,如下所示:
<div class="view-header">
<ul>
</div>
这有点违背了目的,因为 UL 标签被忽略一些浏览器/jQuery 版本。
如何去掉
周围的 div
?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>
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
对于您的具体需求,您可以省去重写模板的麻烦,只需直接配置视图即可使用“HTML 列表”样式,列表类型为“无序列表”。 (在视图配置页面上的“基本设置”下)。
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').
答案是重写
views-view.tpl.php
,这样它就不会生成div
,而是只生成ul
。好吧。现在我只需要找到一个views-view-fields.tpl.php
的模板来覆盖它。The answer is to override
views-view.tpl.php
so that instead of producingdiv
s it only producesul
s. Alright. Now I only have to find a template forviews-view-fields.tpl.php
to override that as well.