Drupal 修剪器导致嵌套 div
我与观点一起工作。视图管理某些文本的显示。我在REWRITE RESULTS
下检查了Trim this field to a maximul length
-box,还检查了Trim only a word
-box和Add一个 eclips...
-盒子。
以前的页面是这样的:
<div class="test"></div>
<div class="test"></div>
<div class="test"></div>
<div class="test"></div>
现在是这样的:
<div class="test"><div class="test"><div class="test"><div class="test"></div></div></div></div>
这是一个(已知的)Drupalbug 还是我在这里做错了什么?
I work with views. A view manages the display of some text. I checked under REWRITE RESULTS
the Trim this field to a maximul length
-box and alsoo the Trim only a word
-box and Add an eclips...
-box.
Where the pages used to look like this:
<div class="test"></div>
<div class="test"></div>
<div class="test"></div>
<div class="test"></div>
now it's like this:
<div class="test"><div class="test"><div class="test"><div class="test"></div></div></div></div>
Is this a (known) Drupalbug or what am I doing wrong here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试切换“删除 HTML 标签”。它确实对我有用!
Try toggeling "Strip HTML tags". It did work for me!
您将该字段限制为多少个字符?
如果它正在修剪字段中的结束并尝试输出
那么可能是 Firefox 自行关闭了 div,或者可能是视图修剪功能尝试在输出之前整理 HTML - 并且它必须猜测 div 应该在哪里关闭,不幸的是,对你来说,通过在字符串末尾关闭它们来猜测是错误的。
最好的选择是让视图在修剪之前剥离 HTML,或者显示未修剪的内容。将 HTML 修剪为固定长度可能会导致各种奇怪的问题,如果你剪掉了两端。
How many characters are you restricting the field to?
If it is trimming the closing 's from the field and trying to output
Then it maybe that either Firefox is closing the divs by itself or it may be that the views trim function tries to tidy the HTML up before outputting it - and it has to guess where the divs should be closed and unfortunately for you, it's guessed wrong by closing them all at the end of string.
Your best option is to either get the view to strip the HTML before trimming, or display it untrimmed. Trimming HTML to a fixed length can cause all kinds of strange issues if you chop off the ends.