R – Drupal: include small form in page.tpl.php

drupal

In my template.php i have a function_name($form) with some basic html markup and a drupal_render($form['mail']) and drupal_render($form) that returns $output;

I'd like to include this small snippet & form in my page.tpl.php. Everything else in page.tpl.php is printed out as a single variable, so I'd like to do that for the $output of the function above.

What is the best way to do this?

Best Answer

In theory you could append the output of the function to the $content variable.

However, It sounds like you have something which may be better off as a block, rather than something that exists in your template.php.

You can quite easily create a module with a single block (which would be your function). You could add this where ever you wanted and easily turn off and on (and all the other block admin goodness) without having to change the code.

Related Topic