I'm developing a module for the first time and crawling slowly up the learning curve.

My question is this.

I'm implementing the form_alter hook to split up a form into chunks. I'd like to feed those chunks into a .tpl file for display, but I'd like the .tpl file to live in my module folder, not in the theme. Reason being, I want to make the module properly portable so you don't have to change the theme's template file or add anything to theme when you want to use it.

So I guess I need to find some way of telling drupal to use the theme template in my module folder when the particular form is shown.

Can anyone help? Would be very grateful:)

Comments

WorldFallz’s picture

Documentation is a beautiful thing:

Documentation -> Developing for Drupal -> Module developer's guide -> Creating Drupal 6.x modules -> Using the theme layer

It's a little deep, but it is there. ;-)

jaypan’s picture

Implement hook_theme. Declare some theme functions that output using .tpl.php files, output your content using the appropriate theme function.

Contact me to contract me for D7 -> D10/11 migrations.