Using a template for a custom admin page made with hook_menu I have developed a module in Drupal 7.

Now, I want to add a custom themed-page in the admin panel of Drupal.

I have added a page using admin_menu():

function newsletter_menu()
{
    $info = array();

    $info['admin/reports/newsletter'] = array(
        "title" =&gt; "Number of Registered Users for Newsletter",
        "description" =&gt; "",
        "page callback" =&gt; "newsletter_admin_content_block",
        'page arguments' =&gt; array('newsletter_admin'),
        'access arguments' =&gt; array('administer newsletter settings'),
        'type' =&gt; MENU_NORMAL_ITEM
    );

    return $info;
}


It works all well. But my problem is:

I have a template file newsletter.admin.tpl.php which I want to use a the template for this page. But I don't know how should I achieve it. Can anyone help?
Have a look at this question on stackoverflow: https://stackoverflow.com/questions/5305114/drupal-7-how-to-load-a-template-file-from-a-module

It basically comes down to this:


Implement hook_theme()
Create the template file
At the end of your newsletter_admin_content_block call theme() with your template key (as defined in hook_theme()) as first argument and any additional variables that you need in your template as an array.


Example:

function hook_theme($existing, $type, $theme, $path) {
  return array(
    'newsletter_admin_content_template' =&gt; array(
      'variables' =&gt; array('var1' =&gt; NULL, 'var2' =&gt; NULL, ...),
      'template' =&gt; 'newsletter-admin-content-template'
    ),
  ),
}


And at the end of your menu callback:

return theme('newsletter_admin_content_template', array(
  'var1' =&gt; $var1,
  'var2' =&gt; $var2,
  ...
));