Render a custom module inside an existing node I have a site in Drupal 7 and I have created a custom module for a functionality that I need. Usually, I create custom modules and I create a new page to show them, using the following code:

function my_custom_module_theme() {
    $items = array();
    $items['my_custom_module'] = array(
        'render element' =&gt; 'form',
        'path' =&gt; drupal_get_path('module', 'my_custom_module') . '/templates',
        'template' =&gt; 'my_custom_module-template',
    );
    return $items;
}

function my_custom_module_menu() {
    $items = array();
    $items['my_custom_module'] = array(
        'title' =&gt; t('my_custom_module'),
        'page callback' =&gt; 'drupal_get_form',
        'page arguments' =&gt; array('my_custom_module'),
        'access callback' =&gt; TRUE,
    );

    $items['my_custom_module'] = array(
        'title' =&gt; t('my_custom_module'),
        'page callback' =&gt; 'drupal_get_form',
        'page arguments' =&gt; array('my_custom_module_empty_form'),
        'access callback' =&gt; TRUE,
    );
    return  $items;
}

function my_custom_module_preprocess_page(&amp;$variables, $hook) {
    $alias = drupal_get_path_alias($_GET['q']);
    if ($alias == "my_custom_module") {
        $variables['theme_hook_suggestions'][] = 'my_custom_module';
        $variables['show_messages'] = TRUE;
    }
}

function my_custom_module_empty_form($form_state) {
    $form = array();
    return $form;
}


and my module appears on mysite/my_custom_module .
What I want to achieve now is to add my custom module at the bottom of an existing node, which has it's own content and functionality.
What should I add to my_custom_module-template.tpl.php or in my node--xx.tpl.php to display my custom module inside the node?
I have already used

&lt;?php
   $nid = xx; // NOTE :: Hard coded, but need to be variable!!
   print drupal_render(node_view(node_load($nid)));
?&gt;   


from a similar Stack overflow question, but it does the opposite of what I want, it renders the node inside the module.
You can implement hook_node_build() in a custom module to add or alter elements when a node's content is by assembled for viewing, right before rendering.

function MODULE_node_build($node, $view_mode, $langcode) {
  // Only do something if the node is rendered on its own page, in full.
  if ($node-&gt;type == 'MODULE_type' &amp;&amp; $view_mode == 'full' &amp;&amp; node_is_page($node)) {
    $node-&gt;content['MODULE_stuff'] = array(
      // Insert render array content here
    );
  }
}


For sorting, you can add a #weight property in the element(s) added to $node-&gt;content. But a nicer solution is to implement hook_field_extra_fields(), so you can position the added element(s) using the usual Field UI.