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);

}




Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. The supported tag styles are: <foo>, [foo].

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.
Bg