Hardcoding something in your module or theme can be just as bad as hacking the core. If the Drupal admin interface allows you the change and configure something, your modules and themes must be scalable enough to account for these changes. This code snippet (example) shows you how you can lookup the CCK field labels, so you'll never have to hard code a label in your theme/module again.
<?php
// create a container for the field labels
$fieldLabels = array();
// load node
$node = node_load('MYCCKNODEID');
// loop through node properties
foreach ($node as $k => $v) {
// ensure this property is a field
if (substr($k,0,6) == 'field_') {
// use the CCK function to get the field data for this field
$fieldData = content_fields($k, $node->type);
// add the label to the array
$fieldLabels[$k] = $fieldData['widget']['label'];
}
}
// for debug, you could now show all the fields with their labels:
echo "<pre>";
print_r($fieldLabels);
echo "</pre>";
?>




















