How can I create template for specific page in module? I am completely new to drupal, and just started learning.

Here's my issue:

I have created a module, called 'doom'. It has only one form.

I would like to remove all the default elements ( header, footer, sidebar ) and to add custom  elements. 

I tried this,

/**
 * Implements hook_theme_registry_alter().
 */
function doom_theme_registry_alter(&amp;$theme_registry) {
    $module_path = drupal_get_path('module', 'doom');
    $template_file_objects = drupal_find_theme_templates($theme_registry, '.tpl.php', $module_path);
    foreach ($template_file_objects as $key =&gt; $template_file_object) {
        if (!isset($theme_registry[$key]['theme path']) || !preg_match('#/themes/#', $theme_registry[$key]['theme path'])) {
            $theme_registry[$key]['theme path'] = $module_path;
            $theme_registry[$key] = array_merge($theme_registry[$key], $template_file_object);
            $theme_registry[$key]['type'] = 'module';
        }
    }
}


This code changes all the pages in the site. But I just wanted to customize the template for 'doom' page.  http://example.com/drupal/doom
As I understood, you need something like this:

/**
 * Implements hook_menu().
 */
function doom_menu() {
  $items['doom'] = array(
    'page callback' =&gt; 'doom_page_callback',
    'page arguments' =&gt; array(),
    'access arguments' =&gt; array('access content'),
    'type' =&gt; MENU_CALLBACK,
  );
}

/**
 * Implements hook_theme().
 */
function doom_theme() {
  // Get the path to this module and define theme dir.
  $module_path = drupal_get_path('module', 'doom');
  $theme_dir   = $module_path . '/theme';

  // Themable elements. This will look for "sample-template.tpl.php" file
  // in the "YOUR_MODULE_DIR/theme" folder. That file can be anything.
  return array(
    'sample-template' =&gt; array(
      'template' =&gt; 'sample-template',
      'variables' =&gt; array('content' =&gt; NULL),
      'path' =&gt; $theme_dir,
    ),
  );
}

/**
 * Menu callback.
 */
function doom_page_callback() {
  // Get your template and display ONLY the contents of that file.
  print theme('sample-template', array('content' =&gt; t('Optionally, pass dynamic content here.')));
}


And the sample-template.tpl.php file:

&lt;div id="sample-template"&gt;
  &lt;?php print $content; ?&gt;
&lt;/div&gt;


This should give you the idea. If you still want to theme the HTML header/footer from the front end theme, you should be able to create page--doom.tpl.php file there and customize what is displayed. In that case, just return the output instead of printing it in doom_page_callback().

Hope this helps.