Render a CCK Image Field


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.