Possible Duplicate:
Listing entity fields

Is there a function or technique anywhere in the Drupal API to list fields for a particular content type?


1 Answer 1


About list your fields for your content type, I guess that you can use node--NAMECONTENTTYPE.tpl.php in your directory template.

to be more detailed, you can copy/paste to your theme directory the file node.tpl.php (located in modules > node or already located inside your theme directory) and rename it according your content type. for example, if the Content Type is Article the name will be node--article.tpl.php

already inside in node--article.tpl.php you can list the fields with the variable $content using print_r($content); to see the list of the fields that you can use to your node (or if you use Devel module, is best use dsm($content);)

to call each field you can use:

for example I have a field called field_demotext1, then:

print render($content['field_demotext1']);

here is the example of zone in the node--article.tpl.php using dsm($content); to print list of fileds:

  <div class="content clearfix"<?php print $content_attributes; ?>>
      print render($content);

Not the answer you're looking for? Browse other questions tagged or ask your own question.