Trouble theming poll block in Drupal 6 I wanted to be able to control the layout and containers for all elements (choice,title,vote etc) inside my poll block and decided to add my own template for the same.

Like any noob, I checked the block with devel and got the block template file,preprocess methods used (in my case poll-vote.tpl inside drupal core poll module and the template_preprocess_poll_vote inside poll.module) and the candidate file name for the template as poll-vote-block.tpl.php inside my themes directory (sites/all/themes/my_theme) and in the theme's corresponding template.php used the preprocess function as follows:

function my_theme_preprocess_poll_vote(&amp;$variables) {
  echo 'Im in';
  $form = $variables['form'];
  $variables['choice'] = drupal_render($form['choice']);
  $variables['title'] = check_plain($form['#node']-&gt;title);
  $variables['vote'] = drupal_render($form['vote']);
  $variables['rest'] = drupal_render($form);
  $variables['block'] = $form['#block'];
  // If this is a block, allow a different tpl.php to be used.
  if ($variables['block']) {
    $variables['template_files'][] = 'poll-vote-block-custom';
  }
  print_r($variables['template_files']);
}


Initially I set the template_files value as 'poll-vote-block' and it didn't seem to be affecting the block, which i confirmed with devel again.

I printed the echo message to ensure the preprocess was called and it did print it. I renamed the template_files (and the template file) and printed it to get the following:

Array ( [0] => poll-vote-block [1] => poll-vote-block-custom ) 

I once came across theme templating in drupal docs that preprocess methods are not necessarily overridden but placed in a queue... to me it appears that my preprocess method's tpl file is set with lower priority and hence unable to override. Hence I'm unable to fulfil my requirement of theming the poll block

It'd be nice know if I'm mistaken with this conception and hope someone would provide me some insight on this to get my problem solved.

Thanks in advance!!

Edit

The problem was finally solved. I created a block-poll.tpl.php file and was then able to override the default poll-vote.tpl.php with my preprocess method and poll-vote-block-custom.tpl.php.

Apparently just like the case where one needs block.tpl.php for his block-module-delta.tpl.php to override a default functionality this might've been my case.

Marking jimajamma's answer as solution as it proves to be a good documentation and reference material worth being a wiki for Drupal theming for novice developers.

Cheers!!
If all you are just trying to change is the layout of the form, and not the data contained in it, all you should need to do is change the CSS for the various wrappers.

In this example, that would be looking at

&lt;div class="poll"&gt;
  &lt;div class="vote-form"&gt;
    &lt;div class="choices"&gt;
      &lt;?php if ($block): ?&gt;
        &lt;div class="title"&gt;&lt;?php print $title; ?&gt;:&lt;/div&gt;
      &lt;?php endif; ?&gt;
      &lt;?php print $choice; ?&gt;
    &lt;/div&gt;
    &lt;?php print $vote; ?&gt;
  &lt;/div&gt;
  &lt;?php // This is the 'rest' of the form, in case items have been added. ?&gt;
  &lt;?php print $rest ?&gt;
&lt;/div&gt;


so, if in your theme CSS you added

.poll {
  color: red;
  background-color: blue;
}


this block would now be in red and blue.

and if you added

.vote-form {
  border: 2px solid green;
}


then the form would have a border of green.  etc etc etc.

Now, if you need to change things up more, add some more divs or change their order, etc, you can just copy the standard poll template to your theme directory, refresh your caches and drupal will pick it up and override the one from poll itself, no need to name it anything different.