获取 CCK 值,无需 Drupal 模板中的 html

发布于 2024-09-02 15:33:44 字数 225 浏览 3 评论 0原文

我将字符串存储在 CCK 字段中。 问题是把它弄回来。我有一个 node-node_type.tpl.php 并要求

$node->content['field_custom_map_data']['#value']

它返回 html、三个嵌套 div 并使用 HTML 实体,我想要输入的纯文本。

Drupal 5 解决这个问题的方法是什么?

I'm storing a string in a CCK field.
The problem is getting it back out. I have a node-node_type.tpl.php and ask it

$node->content['field_custom_map_data']['#value']

That returns html, three nested div's and uses HTML entities, I want the pure text, as entered.

What is the Drupal 5 way to fix this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

贪了杯 2024-09-09 15:33:44

我找到了离线帮助。
Drupal 无法做到这一点,但我可以使用 php 函数 html_entity_decode 来删除实体和 strip_tags 标签。
无论如何,谢谢!

I found offline help.
Drupal can't do it, but I can just use the php functions html_entity_decode to get rid of entities and strip_tags for tags.
Thanks anyway!

梦初启 2024-09-09 15:33:44

我只非常熟悉 Drupal 6,但是您是否尝试过转储 $node->content['field_custom_map_data'] 的内容?如果我没记错的话应该有一个名为 #raw 的键,因此您可以使用 $node->content['field_custom_map_data']['#raw'] 来获取值。

I'm only really familiar with Drupal 6 but have you tried dumping the contents of $node->content['field_custom_map_data']? If I recall correctly there should be a key called #raw, so you could use $node->content['field_custom_map_data']['#raw'] to get the value.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文