How the heck do I print out the cck field in my template?

bflora - November 9, 2008 - 02:36
Project:Relevant Content
Version:5.x-1.3
Component:Code
Category:support request
Priority:normal
Assigned:nicholasThompson
Status:postponed (maintainer needs more info)
Description

I'm trying everything and nothing's working.

How do I print out one of these cck fields?

For instance: print $node->content['field_name_of_relevant_content_field']['#value'] doesn't print out my cck field. And that would work for any other CCK field.

I really like the idea of this module, but I want complete control over where and how it displays. that means being able to print out the field whereever I want.

What's the proper way to print the contents of one of these fields out? Thanks. This is driving me nuts.

#1

nicholasThompson - December 16, 2008 - 06:10
Assigned to:Anonymous» nicholasThompson
Status:active» postponed (maintainer needs more info)

Good question - I'll take a look.

Sorry about the delay in reply. Been silly busy recently.

#2

bflora - December 17, 2008 - 05:32

Don't worry about it. I check back in from time to time. Thanks.

#3

marius.s - December 19, 2008 - 22:10

Subscribing

#4

spanito - March 7, 2009 - 15:45

Hello, I managed to find the way to print the cck field on drupal 6 version of this module. I guess you can work it out for 5.x. I used devel module to get to the right path:

<?php
print $field_name_of_relevant_content_field[#value]['view'];
?>

example:

<?php
print $field_relevant_content[0]['view'];
?>

I hope it can help :)

By the way, I didn't manage to print it from Views 2 (this CCK field doesn't appear in the Fields listing). Any workaround for this issue? Thanks!

 
 

Drupal is a registered trademark of Dries Buytaert.