How to Display CCK Field Contents?

ithacaindy's picture

I'm trying to theme a new content type. I have the node-movie.tpl.php file. I want to display the contents of my field_theater CCK entry. I try the following, but just get a blank:

<?php print $theater; ?>

However, if I try to display the node's title, using the same line, the node's title displays. What am I missing?

Comments

I think you need to edit an

sapark's picture

I think you need to edit an openpublish_core/theme_helpers/node-movie.tpl.inc file to provide the variable to the node-movie.tpl.php file. You could copy the .inc file from a similar content type if node-movie.tpl.inc does not exist and add the variable. For example:

<?php
$vars
['theater'] = $vars['field_theater'][0]['value'];
?>

This makes available the $theater variable to the tpl.php file. If you look at the top of an openpublish_theme/node/*.tpl.php file you will see a list of available variables. This is where they came from.

Have you got the solution to display CCK field?

neerajskydiver's picture

@ithacaindy - Are you able to display CCk entry?

I have tried solution by @sapark also, no luck.

I think what needs to be

ithacaindy's picture

I think what needs to be checked is if you are displaying the fields in your content (content types).

Yes, i am displaying

neerajskydiver's picture

Yes, i am displaying those fields in new content type

OpenPublish

Group organizers

Group categories

Group events

Add to calendar

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week