Custom Template files for Drupal CCK Forms

To render a Drupal CCK form in a template file, add the following lines in the currently enabled theme. Assuming the enabled theme to be footheme

For a cck form called external_exam, the theme function can be used to provide a template file called external_exam_form.tpl.php under templates directory.

<?php
function footheme_theme() {
  return array(
   
'external_exam_node_form' => array(
     
'arguments' => array('form' => NULL),
     
'template' => 'templates/external_exam_form',
     
'render element' => 'form'
   
),
  );
}
?>

Inside the template file, the basic rendering can be done as:

<?php
 
print drupal_render_children($form);
?>

Devel can be used to look at the form and modify it as well.