hi there!
i have a question concerning the theme() function´s granularity. The API sais

If the current theme does not implement the requested function, then the current theme engine is checked. If neither the engine nor theme implement the requested function, then the base theme function is called.

I understand this a a layered approach:

| --- Theme layer
| --- Template engine layer
v --- Drupal layer

i experimented a little bit with this and didn´t get the expected behaviour. I have a smarty template and thus use the smarty engine. now i wanted to override a single function. instead of extending smarty.engine i created a mytheme.module with the single method. but now my smarty template is completely ingored... juck!

i thought this mechanism to be granulated on method level, so that a template and an engine can coexist. but this a rather an eiter-or-situation. did i miss something?

greetings,
henry

Comments

robertdouglass’s picture

Nothing makes it easier to solve code problems than seeing the code.

use ... to have it automatically formatted.

- Robert Douglass

-----
My Drupal book: Building Online Communities with Drupal, phpBB and WordPress

henmue’s picture

@ robertDouglass

hi!
i´m sorry robert, but there´s not really much code.

1. My functional smarty template.

+

2. mytheme.theme with a single method


/* Themable function override */
function mytheme_someThemableDrupalMethod(){ ... }

=

clash :)

In the moment, I introduce mytheme.theme, my smarty template is not longer recognized, styles etc. all gone. If I delete mytheme.theme, the everything is ok again. The method is only defined in mytheme.theme.

henry

robertdouglass’s picture

anything ending in .theme is taken to be a "pure theme" like chameleon. I don't know about the Smarty theme engine, but for the PHPTemplate engine, you're supposed to put your override functions in template.php. You'll have to report back where you end up putting them, whether there is an appriate place in the Smarty engine, or whether you have to create a module just to contain your theme overrides... I don't know since I've never used Smarty.

- Robert Douglass

-----
My Drupal book: Building Online Communities with Drupal, phpBB and WordPress