Drupal 6 - specific template if node contains specific form element I am trying to do a check for if some node contains an input element of type = hidden and with value = 'something'. If this is the case, some specific template should be used for the template.

I am trying to do this check in template.php using the template_preprocess_node() method where I have access to the $vars ($vars['node']) variable. However the only solution I can come up with is to loop through $vars['node']-&gt;webform['components'] and to check for the input type and after that the value.

However I dont find this approach elegant, what are my options?
The relationship between nodes and webform components is maintained in the webform_component table so you should be able to get the data directly from there:

$sql = "
  SELECT COUNT(*) 
  FROM {webform_component} 
  WHERE nid = %d 
  AND value = '%s'
  AND type = 'hidden'";

$args = array($vars['node']-&gt;nid, $field_value);

$count = db_result(db_query($sql, $args));

if ($count &gt; 1) {
  // The webform has a hidden field with the correct value
}