Suppose we have a content type called Silly Question. We can theme the node template by adding the node-silly_question.tpl.php in the theme folder. But if we are working on a module, we should ask Drupal to read the .tpl.php in our module folder first because we shouldn’t ask the module user to copy the .tpl.php from our module folder to their theme folder.
What we need is to implement the hook_theme_registry_alter(). Add it in your .module file.
/**
* Implementation of hook_theme_registry_alter()
*/
function <module>_theme_registry_alter(&$theme_registry) {
$template = 'node';
$originalpath = array_shift($theme_registry[$template]['theme paths']);
$modulepath = drupal_get_path('module', '<module>');
// Stick the original path with the module path back on top
array_unshift($theme_registry[$template]['theme paths'], $originalpath, $modulepath);
}
Replace the <module> with your module name and now Drupal should read the node-silly_question.tpl.php in your module folder first instead of the theme folder.
Done =)

It seems that this article is just drupal 6 related.
What is situation with D7? Can I use this code also for drupal 7 theming?
LikeLike
the above code does not work in Drupal 7. For D7, the following link should help.
Adding a module path to Drupal 7 theme registry
LikeLike