I have installed Template Theme, and it works. Each section of my site now uses a different theme. Here's the problem: the themes only apply on the individual pages. So a page in the "news" category is themed, but the page that shows ALL the news items does not use the news theme.

Anyone have pointers for hacking in a change?

-Tony

Comments

aboyd’s picture

Answer to my own question: the Template Theme module bails out unless it can verify that it is displaying a node, so the trick is to make it relax. So open the taxonomy_theme.module file, and find this:

function taxonomy_theme_nodeapi($node, $op) {

  // bail out if we are not enabled, if it's not a node, or if no nid
  if (!variable_get('taxonomy_theme_enable', 0) || !strstr(arg(0), 'node') || !is_numeric(arg(1)) || !module_exist('taxonomy')) {
    return;
  }

Once you've found that, comment out the line that begins with "if" and add the following new line immediately after or before it:

if (!variable_get('taxonomy_theme_enable', 0) || (!strstr(arg(0), 'node') && !strstr(arg(0), 'taxonomy')) || (!is_numeric(arg(1)) && (!is_numeric(arg(2)) && !strstr(arg(1), 'term'))) || !module_exist('taxonomy')) {

OK? Final result should look something like this:

function taxonomy_theme_nodeapi($node, $op) {

  // bail out if we are not enabled, if it's not a node, or if no nid
  if (!variable_get('taxonomy_theme_enable', 0) || (!strstr(arg(0), 'node') && !strstr(arg(0), 'taxonomy')) || (!is_numeric(arg(1)) && (!is_numeric(arg(2)) && !strstr(arg(1), 'term'))) || !module_exist('taxonomy')) {
//  if (!variable_get('taxonomy_theme_enable', 0) || !strstr(arg(0), 'node') || !is_numeric(arg(1)) || !module_exist('taxonomy')) {
    return;
  }

Basically, I took the searches that looked to make sure the URL was a "node" with an id, and expanded it to allow URLs for the taxonomy overview, too. The end result is that the pages that list everything in a category now use the category theme.

-Tony

aboyd’s picture

I'm stuck again, and I could use some input.

I use taxonomy_theme to have different themes for each section of the site, and it properly displays both for the nodes and for the rollup pages. Well, mostly. If I have not created a node for a section yet, then the page displays, "There are currently no posts in this category." And the theme is the general one, not the section-specific one -- even though I'm on the section page.

Is taxonomy_theme_nodeapi not called if there are no nodes to display? If so, does anyone know if there is a way to make the code from taxonomy_theme_nodeapi run anyway?

-Tony

seaneffel’s picture

Hi Tony,

I don't have an answer, rather another question...

I like the fix you applied to this module but its not working quite the way I was hoping. I wish to make the whole site appear in our standard template, but have all blog type content appear as a different template (thats either an individual node or a node roll).

This is our standard:
http://www.cctvcambridge.org

This is the secondary template, working ok with this patch:
http://www.cctvcambridge.org/node/138

This is link shows all classified node types the way I want:
http://www.cctvcambridge.org/taxonomy/term/16

But this is the node roll by one user, classified properly, but doesn't show the new template:
http://www.cctvcambridge.org/blog/60

Any ideas what I've done wrong?

Thanks!

Sean

sepeck’s picture

With caveats about cvs stuff you could look at this.
http://drupal.org/project/sections

-sp
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

drupalxykon’s picture

Hi,

this module only seems to work for the latest taxonomy category saved. If I assign a theme to terms in 'category 1' and save , it works fine...however, as soon as I assign a theme to 'category 2', 'category 1' stops working.

(sizeof($terms) in function taxonomy_theme_nodeapi($node, $op) seems to return 0. It looks like the previous mapping is being erased. where is everything stored? in a table?

Regards,

V

Marco Palmero’s picture

The code for the taxonomy theme module has changed so this change cannot be implemented anymore.

____________________________________________________________________________
Blog | Sydney News | Photography | Travel |Best Designed Drupal Websites