Theming Drupal 6 from the Module layer

Really good article on theming Drupal 6 from the Module layer

http://11heavens.com/theming-Drupal-6-from-the-module-layer

/**
* Provide module theme PAGE.tpl
* @param $variables
* @return unknown_type
*/

function MODULENAME_preprocess_page(&$variables) {

// Get VIDEO url
$url = "videos";

if(arg(0)==$url) {

$variables['template_file'] = 'page-bc-video';

}

//print_r($variables);

}

/**
*
* Add the template path from within module folder to drupal
*
* @param $theme_registry
* @return unknown_type
*/

function MODULENAME_theme_registry_alter(&$theme_registry) {
$theme_hook = 'page'; // my hook name
// Get the path to this module
$modulepath = drupal_get_path('module', 'MODULENAME');
// Add the module path on top in the array of paths
array_unshift($theme_registry[$theme_hook]['theme paths'], $modulepath);

}




Bg