Render a CCK Field


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



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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.