Module Template System

Drupal Modules - Fri, 03/10/2008 - 8:19pm

Drupal 5 doesnt have a nice easy way for module developers to drop .tpl.php files in their module directories for use with modules that do a lot of output. I have no idea why. Drupal 6 has this but 5 does not. So I've created a module that allows module users to mimic the features of drupal 6 without the need to modify drupal 5 core files. It's not identical or perfect but its about as close as you can get without actually upgrading to 6 which may not be a path you can take because maybe some of your modules dont have a D6 version. Also, this system doesnt lock you into a '$content' variable like the normal drupal page template does. It allows you to create the '$content' using the $vars variable. $vars is an array that contains values that come straight from your module. There is also a custom_template.php file that allows themers to inject stuff into the $vars variable as well just like they would with drupal's template.php. Here's a small list of what this module allows you to do:

Create template files in your own Module directory (these can then be overridden by files of same name in current template dir as usual)
Send variable directly to a template (something not possible in d5 and I dont even think d6 does this either, though not sure on that).
New custom_template.php file for themers to use just like drupal's template.php

read more