How can I output the CCK fields in a print.tpl.php file?

For example i have screenshots which can be added an unlimited times. So a node can have 6 screenshots. Now I would like to output these screenshots in a pdf document when I use the [Printer, e-mail and PDF versions] module.

Any suggestions?

Comments

graysadler’s picture

In your template file you'd need to loop through all the cck fields you want to display. I haven't tested this code, but it would look something like this:

<?php
  //this code creates an item list of screen shots from the rendered 'content' key of a node
  //it assumes that the cck field is an associative array and loops through each image found
  //and puts them in an unordered list. they are put in an unordered list just to keep them vertical

  $items = array();

  foreach($node->content['field_screenshot'] as $img) {
    $items[] = $img;
  }

  print theme('item_list', $items);
?>

Lead Developer and Founder of StreamRiot.com