The module appears to only draw it's themeing from the built in events.theme file.

My colleague and I have tried (and failed) to find out why this is. We have tried everything (even reading the pro development 2nd edition book) and can not seem to override anything other than the css in our custom theme.

This is causing lots of swearing and we are in danger of having to hack the module files (such a bad idea) to be able to get the output as we want it.

Help is desperately required!

Comments

frank ralf’s picture

Hello,

"Learning Drupal 6 Module Development" by Matt Butcher contains a section about "template.php Gotchas" on page 88 in chapter 3 about The Theme System.

This gives some hints how to overcome problems when trying to theme your content with sub-themes, as you can only override a theme function once (i.e. not in the sub-theme if the same function is already declared in the parent theme).

And if you use a function in phptemplate_hook then this will override the theme function in hook.tpl.php.

You should not use phptemplate_hook but one of the preprocessor functions such as phptemplate_preprocess_block etc.

Hope that will help you.

Kind regards
Frank

abamarus’s picture

Thanks for your input, Frank. I think you may have misunderstood the problem though.

The events module contains it's own sub theme. (That's what it looks like to us anyway).

Using the drupal naming conventions our theme should be able to override the modules theme so we can change the markup however we want using names like mythemename_hookname

This is simply not working and the module theme is always being used for output. We are not getting errors about redeclaring functions. We just need to know how to get our theme used instead of the modules theme.

frank ralf’s picture

Hm, could you perhaps post a code snippet to illustrate the problem?

abamarus’s picture

We have tried following the instructions at this link exactly and have had no joy.

http://evenhouseconsulting.com/blog/2006/aug/10/how-override-theming-dru...

Looking at the books (module dev and pro dev) all lead us to believe that this should work and we assume that it did in previous versions or the above site would not have these instructions!

frank ralf’s picture

Thanks for the link. I will have a look at it and give it a try myself.

frank ralf’s picture

The following code does work with my installation of Drupal 6.4 (in template.php file in your theme folder):

function zen_event_upcoming_item($node) { 
  // Initialize the content 
  $output = "TEST: "; 
   // Put in the event title with link and some more HTML - just for testing
  $output .= "<em>" . l($node->title, "node/$node->nid", array('title' => $node->title)) . "</em>"; 
  // Return the output back to Drupal for display 
  return $output; 
} 

Have you remembered clearing your cache?

abamarus’s picture

Yes... the cache has been cleared (it is disabled but clicked on clear anyway just to be sure!).

This is weird because it does not work for us. Our theme is a sub theme of garland - this should not effect things surely... or perhaps it does... will experiment a bit more and get back to you...

Thanks for bearing with me on this!

chasz’s picture

subscribing

i would like to theme it as well....what exactly are u trying to do???

is it possible to add cck fields in the events calendar views??

frank ralf’s picture

As my theme is a sub-theme of Zen this might be a Garland specific bug. You might have a look at the following post:

"Garland overrides template with theme function"
http://drupal.org/node/295895

PS:
Oops, it's not the cache, it's the theme registry which has to be cleared (http://drupal.org/node/173880).

chasz’s picture

when u clear cache it clears that too :D

killes@www.drop.org’s picture

Status: Active » Fixed

I am marking this fixed, Frank gave a lot of input wrt to theming.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.