Custom module with custom theme/template I have tried to get this question answered in the past, but I was never given a satisfactory response.

I am building a custom module. I do not want the module to inherit the current theme being used by Drupal core; it should have its own themes/templates. This is the code I have written.

myApp.module

// $Id$
require_once ('myApp.theme.inc');
function myApp_menu() 
{
 $result = array();
 $result['myApp'] = array(
    'title' =&gt; "My App",
    'page callback' =&gt; "myApp_home",
    'access callback' =&gt; true,
    'type' =&gt; MENU_NORMAL_ITEM,
    'weight' =&gt; 1,
  );

 return $result;
}

function myApp_home(){   
    $output = theme('myApp_home', array('data'=&gt; '')); 
    return $output;
}


myApp.theme.inc

function myApp_theme() {
    $path_to_theme = drupal_get_path('module', 'myApp')."/theme/";      

    $themes = array(); 
    $themes['myApp_home'] = array(
    'template' =&gt; 'myApp_home',
    'path' =&gt; $path_to_theme , 
    );
    return $themes;
}


myApp_home.tpl.inc

&lt;html&gt;
&lt;head&gt;&lt;/head&gt;
&lt;body&gt;Hello World&lt;/body&gt;
&lt;/html&gt;


The problem is that the module still resides within the Drupal core. I want to have it be a full page web application.

I am new to this, so if anyone could provide an explanation of the best practice, and example code, I would really appreciate it.
As Clive said, you can simply return HTML instead of the render array, e.g. 

function myApp_theme() {
    $html = "&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Hello World&lt;/body&gt;&lt;/html&gt;;      
    return $html;
}


A more general way is to modify the page.tpl.php in your theme and add a wrapper around the normal styling.  E.g.

&lt;?php if ( $plain_page ) { ?&gt;
  &lt;?php print render($page['content']); ?&gt;
&lt;?php } else { ?&gt;
Normal stuff
&lt;?php } ?&gt;


Then in your module, use the template_preprocess_page hook to set the $plain page variable.  E.g.

my_module_preprocess_page( &amp;$vars ) {
  [ check if it's a page you want as plain ]
    $vars['plain'] = TRUE;


You will only need the content for the  tags as the html.tpl.php template handles that.