Hi all,
I'm trying to get a CCK text field to process php. This seems to work and not work for me. When I view the resulting node it works fine but when i try and print out the field in another context, the php does not get processed.
The code I use for display the content of the field is the following (part of it):
//Do middle box
if($anodeTwo->field_auglysing_2)
{
$middle_box_obj = $anodeTwo->field_auglysing_2;
$middle_box = $middle_box_obj['0'];
$middle = $middle_box['value'];
if($middle)
{
print '
';
}
}
This has always worked with text so far but for some reason if I use php code in that field it never gets processed :(
You can see the source here: http://www.hi.is/is/auglysingar/auglysingar_fyrir_felagsvisindasvid
and there is also a screenshot.
Any ideas? I gotta be doing something stupid!
best regards, Logi
| Comment | File | Size | Author |
|---|---|---|---|
| screenshotdrupal.JPG | 76.31 KB | Logi-1 |
Comments
Comment #1
Logi-1 commentedSorry had to remove the content on the page and cannot link externally to my dev server, if anybody has any ideas, please share :)
Comment #2
markus_petrux commentedIf you do it that way, then you're just rendering the field value as-is, which is your PHP snippet. Instead, try using content_format() or something similar. Not sure if there's documentation for this related to CCK for D5, anyway see content.module and search for content_format() to read the inline docs.
Comment #3
Logi-1 commentedRight!
That worked, thanks for that :)
I changed this to: $middle = content_format('field_auglysing_2', $anodeTwo->field_auglysing_2[0], 'default', $node);
best regards, Logi