I wish to create an invoice template.

I have used hook_theme.

/**
 * Implements hook_theme().
 */
function MyModule_theme($existing, $type, $theme, $path) {
	return array(
	    'MyModule_invoice' => array(
	    	'variables' => array('invoice_content'=>NULL),
	    	'template' => 'templates/invoice',
	    ),
	);
}

Unfortunately, the template is showing in the content region/block of my site.

I need the template to be a completely separate html page outside of my site theming, so that it can be printed off without the site appearance.

I hope this makes sense and I am sure there is a very easy solution...

Comments

nevets’s picture

Not sure how this relates to the question.

JamesRobertson’s picture

Possibly my original query was not clear enough. There are times when we need to produce pages which do not have the appearance of the site - i.e no menus, no logo, no side bars...

Such a time would be when you want produce a clean looking invoice.

If I create a template it will appear in the $page['content'] area of the website by default (it appears to me). However, using template_preprocess_html and template_preprocess_page I am able to create a stand-alone page.

nevets’s picture

More in line with the "Drupal way" is to have the menu callback that generates the page is to have it render/print the page instead of returning the page content.

nevets’s picture

Theme functions/templates do not (or at least should not) determine the placement of content.

Placement between main content and blocks is determined how the invoice is generated. An invoice that is meant to be a page should have a path and callback defined in hook_menu. Content in blocks would be defined in the hook_block_* hooks.