Search code examples
phpdrupaldrupal-6cckdrupal-theming

a way to create a dynamic loop for a drupal cck field with multiple values


i have a list of links that i want to print similar to Drupal: Associating grouping more than one CCK field but the multigroup module is no longer active (as of like a month after that post) i have been printing them like so:

<?php if($node->field_committee_link[0][value]): ?><h4>1) <a href="<?php print $node->field_committee_link[0][value] ?>"><?php print $node->field_committee_link[0][value] ?></a></h4><?php endif; ?>
<?php if($node->field_link_descriptor[0][value]): ?><?php print '&nbsp;&nbsp;&nbsp;&nbsp;'. $node->field_link_descriptor[0][value] ?><?php endif; ?>

and changing the numbers

is their a way to loop through such as

for $node->field_committee_link[0][value] to $node->field_committee_link[x][value] print $node->field_committee_link[x][value] x= i++ next

or would i need to preprocess this?

help greatly appreciated


Solution

  • Try...

    foreach ($node->field_committee_link as $link) {
      print $link[value];
    }