Hello all. I have been spending alot of time learning about Drupal and am currently implementing a golf score tracker module call GolfPal. My module will be implementing various new node types such as "Golf Course" and "Golf Score".
My question is probably simple. I want to enable some default theming as part of my module. In other words I want to override such things like theme_node_form in my module using phptemplate. I put the following code in my .module file:
function phptemplate_node_form($form) {
return _phptemplate_callback("node_form", array('form' => $form));
}
And this hooks into the function BUT it looks for the node_form.tpl.php in my theme directory. I want to be able to keep these template files with my module. Is there a way to make this happen. I do see other modules implementing theme.php in the module directory but how they are getting that to execute is eluding me.
Any guidance would be greatly appreciated.
Thank you.
Comments
up up up i also want to
up up up
i also want to know !
--------------------------------------------------------------------------
Women Lose Weight-->I would love to lose weight!
Just using the theme...
I am currently just developing a theme along side my module to solve this right now. Is what I am proposing not considered best practice?
Any guidance would be greatly appreciated.
Thanks.
From looking at the source
From looking at the source for the PHPTemplate functions, it seems that the paths are hard-coded using path_to_theme(). You can see for yourself by looking at the code in http://api.drupal.org/api/function/_phptemplate_default/5 .
Very annoying, I've been wanting to do the same as you without resorting to having HTML in my module.
I suspect there is some horrible way you could hack it by temporarily replacing the path stored in $themes[$theme]->filename while you render your template - see the source at http://api.drupal.org/api/function/path_to_theme/5 for what I'm getting at. No promises that Drupal won't die a horrible death though...
Interesting.
Interesting, it seems you may be correct. I believe this is solved in Drupal 6 with hook_theme but am not positive.
...
Not possible in 5.x that I'm aware of but, yes, fixed in 6.x. That's why you have to copy them over for my modules. :(
Michelle
--------------------------------------
See my Drupal articles and tutorials or come check out life in the Coulee Region.