Project:Themer
Version:6.x-2.0-3
Component:Documentation
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

It seems to be just me since there is no sign of this issue anywhere else, but I can't get the classes to print, is there anything I need to put in template.php or in page.tpl.php to get it to print them or should that all be fine without changing anything? At the moment in the body tag in page.tpl.php I have the fairly standard:

<body<?php print phptemplate_body_class($left, $ight); ?>>

Which I need to keep, do I need to make any changes to this?

Comments

#1

That may be an issue. Which theme are you using? If the theme is 'greedy' and prints out class="", this is a bad practice, as now you cannot manually add more such as class="

<?php
print phptemplate_body_class()
?>
my-special-class", however you would need to use themer_body_class() which returns a string of joined classes, which Ideally would be in the page preprocess hook so you could just place
<?php
$body_class
?>
or something... basically they should not have assumed that their func would be the only one printing classes

#2

I think it's worthwhile to utilize the power of <a href="http://api.drupal.org/api/function/template_preprocess_page">template_preprocess_page()</a> to add classes to the body instead of creating separate function in this module.

Drupal 6.x core creates an array of body classes in its template_preprocess_page() implementation; since preprocess functions work at both the module and theme levels, it makes sense to simply tap into that. Why duplicate the work and ignore Drupal's default output? :)

Here's an example:

function THEME-OR-MODULE-NAME_preprocess_page(&$variables) {
  /*
   * Add more body classes
   */
  $body_classes = array($variables['body_classes']);

  // Show/hide admin area using CSS
  if ($variables['is_admin']) {
    $body_classes[] = 'admin-panel';
  }

  // Add new body classes to existing variable
  $variables['body_classes'] = implode(' ', $body_classes);
}

Of course, page.tpl.php needs to print the $body_classes var passed to it from this function:

<body class="<?php print $body_classes; ?>">

#3

I am having the same problem. Installed and configured Themer, cleared cache, checked the permissions but I cannot see the extra body classes. I am using Basic as my theme...

Thanks,

Sinan

#4

Just to add to my previous comment;

I have tried Themer on different websites with different hosts and different themes to no avail. I cannot see the created classes. I am using Drupal 6.14. Do you think it is related to the core version?

Here is an example page with Themer enabled: http://sandbox.bilimternet.com/content/snn1

#5

I'm having this problem with IE 7/8.

My body tag looks like this:

<body class="<?php print $body_classes; ?> <?php print themer_body_class(); ?>">

--

Firefox 2/3 output:
<body class="front logged-in node-type-page one-sidebar sidebar-left front admin-menu">
(looks good to me)

IE 7/8 output
<body class="admin-menu">

I'm using the latest stable iteration of the zen theme. (6.x.1.1)

#6

+1 !

Hi, everybody ! don't know if anyone can/will answer, since this is a rather old subject, but i've been trying many different approaches (see Background Image Discussion ) to have themer module work, and... It doesn't ! No output at all ! Must come from something i've mistaken, if this version is assumed to work with Drupal 6.15.
Saveral persons seem to have the same issue, maybe we just badly need a simple manual, maybe it all is a little bit more difficult.
Some answers might be quite helpful. Many thanks in advance...

#7

I think this issue is related with the theme. With some versions of Basic theme, I managed to make Themer work. On some other versions of Basic and on other themes, it doesnt work...

#8

Thank you for the answer, even if it's not the expected one !
By the way, did you find another solution to get a different background image in each node content ?

#9

Know this post is old, but I'd prefer not use this module. Went through a bunch of posts on adding body classes but I can't get it to print a cck field as a class.

Any help would be appreciated...

#10

Maybe THIS could help.
I have to try this solution too.
If we join our efforts... Who knows ? ;-)

#11

Thanks so much! Solved my [boneheaded] issue. It was printing two classes because I had two different classes declared in the .

#12

Thanks, agojc. I saw on that other thread that you had to go to the Themer configuration screen. It should work out of the box without having to visit that screen, but in any case, I'm glad I finally got this to work. The config screen is at Administer > Site Configuration > Themer. This is the only thing you have to do after following the README's instructions to add PHP to your body class.

#13

I have a simple question.
What is the difference between:

THEME-OR-MODULE-NAME_preprocess_page(&$variables)
and
THEME-OR-MODULE-NAME_preprocess_page(&$vars, $hook)