0

I am using Drupal 7.14. I have a custom module with a number of different output pages. I define the paths in hook_menu and then in the callback functions I do some work and call echo theme('mytemplate', array(..args...)) at the end to output my content.

I also have a second custom module that does different work but outputs its content in a similar way.

I want to output some wrapping html that is common to the two module page outputs. At the moment the way I do this is to require a head and foot html file in each of the module template files.

This doesn't feel like a very Drupal approach so I'd appreciate some guidance.

Note: the wrapping html is specific to these two modules so I'd prefer not to pollute my main page.tpl.php file with it.

1

The only thing I see you could do is to have one commeon theme function and let one module depend on the other (you should specify this in the .info file). If you are going to have more modules with them same requirement you could have a central output module doing the theming.

  • Yeah I did create another module as you suggested that handles the output of the extra wrapping html. I also decided to update my main page.tpl.php with two variables that get output before and after the main content. (despite not wanting to modify the page.tpl :) – hgg Aug 21 '12 at 9:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.