views:

17

answers:

1

I have a Drupal set up with CKEditor and CCK, with a custom node which has some additional fields using CKEditor, one field being 'related_news'.

I'm trying to figure out the best practice for returning that data safely. What I have right now is:

$node = noad_load(35);
<h3>Related News</h3>
<?php print $node->field_related_news['0']['value']; ?>

But that returns potentially dangerous data, since no filtering is being used on it.

I've gone to my Input Settings and enabled Filtered HTML and I'm still getting this issue.

Any ideas? Best practices?

+1  A: 

First of all, when you create the CCK field, there is a setting (under Global Settings)

Text processing:
[ ] Plain text
[x] Filtered text (user selects input format)

I hope you selected that the Filtered text setting. Only then it is input filtering done for that field.

The filtered string should be available as

$node->field_related_news['0']['safe']

Sid NoParrots

related questions