The Stack Overflow podcast is back! Listen to an interview with our new CEO.
2 added 635 characters in body
source | link

I have some theme functions defined in my theme's template.php file that I am calling in my modules with no problems.

I also have some theme functions defined in my_module.module that are also working.

I'm doing some work on themed automated emails with custom rules actions and I found that when rules calls theme functions defined in my theme's template.php file they don't return anything, but when calling the same functions copied and pasted to my_module.module the return what I expect.

I also found that bypassing rules and doing the same process (calling the functions from both locations) in a hook_nodeapi in the 'presave' case gives me the same behaviour. (Strangely however they work in the 'load' case.)

Is there a way I can have my theme functions neatly defined in my theme's template.php where they are already working for all my other modules, and still get at them with rules / hook_nodeapi?

Thanks!

EDIT - more info:

Thanks guys. The reason I put them in the theme to begin with is because I'm working on a multi-domain profile with a parent theme and a subtheme for each sub domain. They were template functions for html emails that need to be branded in with images and styles from each subtheme. I've had problems with putting template theme functions in modules because the path to the templates defaults to the module directory, and I need the template to be selected dynamically based on which subtheme it was called from. Thats why I wanted to define them in the parent theme so they could be overridden per child theme.

I have some theme functions defined in my theme's template.php file that I am calling in my modules with no problems.

I also have some theme functions defined in my_module.module that are also working.

I'm doing some work on themed automated emails with custom rules actions and I found that when rules calls theme functions defined in my theme's template.php file they don't return anything, but when calling the same functions copied and pasted to my_module.module the return what I expect.

I also found that bypassing rules and doing the same process (calling the functions from both locations) in a hook_nodeapi in the 'presave' case gives me the same behaviour. (Strangely however they work in the 'load' case.)

Is there a way I can have my theme functions neatly defined in my theme's template.php where they are already working for all my other modules, and still get at them with rules / hook_nodeapi?

Thanks!

I have some theme functions defined in my theme's template.php file that I am calling in my modules with no problems.

I also have some theme functions defined in my_module.module that are also working.

I'm doing some work on themed automated emails with custom rules actions and I found that when rules calls theme functions defined in my theme's template.php file they don't return anything, but when calling the same functions copied and pasted to my_module.module the return what I expect.

I also found that bypassing rules and doing the same process (calling the functions from both locations) in a hook_nodeapi in the 'presave' case gives me the same behaviour. (Strangely however they work in the 'load' case.)

Is there a way I can have my theme functions neatly defined in my theme's template.php where they are already working for all my other modules, and still get at them with rules / hook_nodeapi?

Thanks!

EDIT - more info:

Thanks guys. The reason I put them in the theme to begin with is because I'm working on a multi-domain profile with a parent theme and a subtheme for each sub domain. They were template functions for html emails that need to be branded in with images and styles from each subtheme. I've had problems with putting template theme functions in modules because the path to the templates defaults to the module directory, and I need the template to be selected dynamically based on which subtheme it was called from. Thats why I wanted to define them in the parent theme so they could be overridden per child theme.

1
source | link

Why can't I call theme functions declared in template.php in mymodule_nodeapi hook?

I have some theme functions defined in my theme's template.php file that I am calling in my modules with no problems.

I also have some theme functions defined in my_module.module that are also working.

I'm doing some work on themed automated emails with custom rules actions and I found that when rules calls theme functions defined in my theme's template.php file they don't return anything, but when calling the same functions copied and pasted to my_module.module the return what I expect.

I also found that bypassing rules and doing the same process (calling the functions from both locations) in a hook_nodeapi in the 'presave' case gives me the same behaviour. (Strangely however they work in the 'load' case.)

Is there a way I can have my theme functions neatly defined in my theme's template.php where they are already working for all my other modules, and still get at them with rules / hook_nodeapi?

Thanks!