开发者

Get CCK values, without the html in Drupal templates

开发者 https://www.devze.com 2022-12-30 20:01 出处:网络
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

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 Drupa开发者_开发知识库l 5 way to fix this?


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!


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消