Posted By

level09 on 11/10/09


Tagged

output drupal field cck templatephp


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

ReeceMarsland


Render a CCK Field


 / Published in: PHP
 

  1. function render_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 .'"><div class="field-label-inline-first">' .$title .' </div> ' ;
  12. $output .= $field[$i]['view'];
  13.  
  14. $output .='</div>';
  15. }
  16. return ($output);
  17. }

Report this snippet  

You need to login to post a comment.