[support] Using the node theme or a template from custom module

Joel Willers joel.willers at sigler.com
Wed May 30 14:34:44 UTC 2012


Since it's not a node, it won't render like a node. Does it use page.tpl.php? Sadly, I'm no expert in template files. I'd be interested in the solution to this, so if you figure it out, could you respond and post it? Thanks!

Joel 


-----Original Message-----
From: support-bounces at drupal.org [mailto:support-bounces at drupal.org] On Behalf Of DTH
Sent: Monday, May 28, 2012 4:43 PM
To: support at drupal.org
Subject: [support] Using the node theme or a template from custom module

I've got a custom module for D7. On some pages, it returns html. I'm using this in the page callback

function example_page(){
    return array(
      "#type" => "markup",
      "#markup" => "<p>Lorem ipsum etc</p>",
    );
}

It works fine, but the page (obviously) doesn't use my node.tpl file, and so it looks different from the rest of the site. It's not that the node.tpl file is particularly complex, but it does some things like wrap the node content in divs that have styling applied to them etc.

I could use #prefix and #suffix to wrap the above output in these divs, but is there either a) some way to reuse my node template or b) what's the best way to create a quick clone of the node template that can be reused in render arrays every time I want to output pages from my module. Do I have to call a theme function by #theme or is there a way to use an actual template file?
--
[ Drupal support list | http://lists.drupal.org/ ]


More information about the support mailing list