tags:

views:

467

answers:

2

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?

+1  A: 

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.

Jeremy French
A: 

The other thing you could try out is the webform module. It's a nice module that has a large feature set, saving you the trouble of having to create a module. You can have a webform block which you can stick on that particular page (restrict to page).

I also see that your form is called mail. Webform also allows you to email form submissions. In addition, it provides a nice interface to see what users have submitted.

topologicc

related questions