Posted By

level09 on 11/10/09


Tagged

output drupal field cck templatephp Imagefield


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

ReeceMarsland


Render a CCK Image Field


 / Published in: PHP
 

  1. function render_image_field($node,$name,$title=null,$divclass=null,$limit=0,$start=0)
  2. {
  3.  
  4.  
  5. $field_name = 'field_'.$name;
  6. $field = $node->{$field_name};
  7.  
  8. $limit = ($limit == 0) ? count($field): $limit;
  9.  
  10. for ($i=$start; $i < $limit; $i++) {
  11. $output .= '<div class="field field-item'. ' '.$divclass .'"> ' ;
  12. $output .= $field[$i]['view'];
  13. $output .= '<span>' .$field[$i]['data']['description'] .'</span>';
  14.  
  15. $output .='</div>';
  16. }
  17. return ($output);
  18. }

Report this snippet  

You need to login to post a comment.