如何在 Drupal 视图中删除图像缓存类
我正在努力缩小我的观点。它们将图像显示为图库并将它们嵌套在图像缓存类中。我已经设法删除了大部分不需要的代码,但有两个部分仍然存在问题。这是代码(在本例中,视图的一部分在行中只有一张图片):
<tr>
<td>
<div class="">
<div class="views-field-field-FIELDNAME">
<span class="field-content"><div class="">
<a href="/address"><img width="XYZ" height="XYZ" class="imagecache imagecache-XYZ imagecache-default imagecache-XYZ_default" title="TITLE TEXT" alt="ALT TEXT" src="XYZ.jpg"></a></div></span>
</div>
<div class="views-field-field-FIELDNAME">
<span class="field-content">
<div class="">
<a href="/address">TITLE</a></div></span>
</div>
</div>
</td>
</tr>
我要删除的是该部分,
<div class="">
因为它是空的且不必要的。
我需要删除的第二个是“a class”类:
class="imagecache imagecache-XYZ imagecache-default imagecache-XYZ_default"
它们太多了,我不需要任何。如果不可能的话,我想只保留一个而不是四个。
我想它应该在 content-field-...tpl.php 内部解决,但我没有看到任何可以删除以删除这些部分的代码。
I'm trying to reduce the size of my views. They display images as a gallery and nest them in imagecache classes. I have managed to remove most of the unwanted code, but two parts remain problematic. Here is the code (part of the view with only one picture in row in this case):
<tr>
<td>
<div class="">
<div class="views-field-field-FIELDNAME">
<span class="field-content"><div class="">
<a href="/address"><img width="XYZ" height="XYZ" class="imagecache imagecache-XYZ imagecache-default imagecache-XYZ_default" title="TITLE TEXT" alt="ALT TEXT" src="XYZ.jpg"></a></div></span>
</div>
<div class="views-field-field-FIELDNAME">
<span class="field-content">
<div class="">
<a href="/address">TITLE</a></div></span>
</div>
</div>
</td>
</tr>
What I want to remove is the part
<div class="">
because it is empty and unecessary.
The second this I need to remove is are "a class" classes:
class="imagecache imagecache-XYZ imagecache-default imagecache-XYZ_default"
There are too many of them and I don't need any. If it is not possible, then I'd like to keep only one instead of 4 of them.
I guess it should be solved inside of content-field-...tpl.php, but I don't see any code there which could be deleted to remove these parts.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要删除imagecache类:
您可以在sites/all/modules/imagecache/imagecache.module中找到theme_imagecache_formatter_default()函数。
您可以覆盖它,定义您自己的函数,省略“$class”定义。
Drupal.org 上有一个关于覆盖 theme_iamgecache_formatter_default 的帖子可能会有所帮助。
至于具有空类的 div:您是否使用任何视图模板覆盖? 我的网站上没有空
代码,这让我想知道您是否正在修改或覆盖任何视图模板。如果是这样,您可以尝试回滚这些更改以查看空类 div 是否消失。
To remove the imagecache classes:
You can find the theme_imagecache_formatter_default() function in sites/all/modules/imagecache/imagecache.module .
You can override that, defining your own function, omitting the "$class" definitions.
There's a thread on Drupal.org about overriding theme_iamgecache_formatter_default that may be helpful.
As for the divs with empty classes: Are you using any views template overrides? I don't get that empty
code on my sites, which makes me wonder if you're modifying or overriding any of the Views templates. If so, you might try rolling back those changes to see if the empty-class divs disappear.