2

Having some module, defined some url in hook_menu() and need to display there some theme (modules/mymodule/templates/mytheme.tpl.php). How do I show mytheme.tpl.php content on needed url?

function mymodule_menu(){
    $item = array();

    $item['somemenu'] = array(
     'page callback' => 'somemenu_display',
  );

    return $item;
}

function somemenu_display(){
       return WHAT_IS_THIS_FUNCTION('modules/mymodule/templates/mytheme.tpl.php');
}

And it will be good to display only these contents, without and header/footer.

Jokerius
  • 1,310
  • 1
  • 14
  • 22

1 Answers1

2

The function is Theme()

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

You then 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 your module.

Terry Seidler
  • 2,043
  • 15
  • 28
Jurgo
  • 907
  • 4
  • 18