0

I want to create a custom theme for a specific page. (e.g. www.domain.com/roster/%/home) For this purpose I've created the following file and placed it within the templates folder of my current theme (bartik): page--roster--home.tpl.php.

It overrides the default theme as desired, but I want to keep all files related to my module within its folder.

My question is, how can I place the file within my module's folder and still have Drupal 7 pick it up?

Saahir Foux
  • 654
  • 4
  • 12
  • 27

1 Answers1

2

use Theme()

return theme('some_theme_function_template', array('aValues' => $someArray));

Then you need to use the theme hook like this:

function my_module_name_theme() {
    return array(
        'some_theme_function_template' => array(
            'template' => 'mytheme',
        ),
    );
}

It now searches for mytheme.tpl.php in the root of you're module.

Jurgo
  • 907
  • 4
  • 18
  • Thank Jurgo! I haven't been able to test your implementation yet, but I will be able this weekend. It looks good, and when I try it out I'll post another comment. – Saahir Foux Aug 24 '12 at 07:49
  • As it turned out, my priorities shifted that week and I had to move onto other things. I've recently got back to this and was able to successfully implement the Theme() function. Thanks for the help, Jurgo! – Saahir Foux Feb 11 '13 at 21:48