I’ve got this problem. I’ve created file node–mycontenttype.tpl.php to display nodes in custom way. I’ve listed all the $content array by print_r($content). I can display all the variables except CCK fields. For example I can print out node type like:
<?php print $content['body']['#bundle']; ?>
But if I try to display any CCK field like:
<?php print $content['body']['#object']->field_url[und][0]['value']; ?>
It gives me an error “Notice: Use of undefined constant und – assumed ‘und’ w include()”. Alright, so the “und” means “undefined” for langauge, but nor ‘pl’, nor ‘en’ solves the problem. How can I manage this?
Alright, after researching I’ve finally found an answer. It works, but in some cases it look a bit inefficient. Code goes like this:
But if you have a lot of CCK fields it looks like you have to launch field_get_items() function a lot of times. If any of you knows a better approach it could be nice you could share.