Attached is a patch against 4.6.0 to allow themeable taxonomy term pages (e.g. http://www.your-site.com/taxonomy/term/15). This allows theme developers to override the taxonomy term node listings.

The hooks provided are:

  • theme_taxonomy_node_list($result, $rss_tids, $depth)
  • theme_taxonomy_node($node)
CommentFileSizeAuthor
taxonomy-term-theme.patch1.79 KBkrumms

Comments

drumm’s picture

function theme_taxonomy_node($node) {
  return node_view($node, TRUE);
}

Since nodes are already themeable this function doesn't need to be themeable.

function theme_taxonomy_node_list($result, $rss_tids = NULL, $depth = NULL) {
  if (db_num_rows($result) > 0) {
    while ($node = db_fetch_object($result)) {
      $output .= theme('taxonomy_node', node_load(array('nid' => $node->nid)));
    }
    $output .= theme('pager', NULL, variable_get('default_nodes_main', 10), 0);
  }
  else {
    $output .= t('There are currently no posts in this category.');
  }

  if (isset($rss_tids) && isset($depth)) {
    $output .= theme('xml_icon', url("taxonomy/term/$rss_tids/$depth/feed"));
  }

  return $output;
}

I think your average themer using phptemplate or somesuch might be a bit scared of this since it mixes database functions and somewhat complex php logic. And there are a few other places which do node listing that could benefit from a bit of themeability (node and blog modules).

I think I would implement this as a non-themeable function which takes arguments such as:

- sql query result with a nid column.
- (potentially themeable) function to call to wrap the node listing. Would default to something simple that throws an xml icon at the bottom.
- (potentially themeable) function to call to render each individual node. Would defualt to node_view.

I think that might be enough for this round of development. I think there could be more work to do, such as making the RSS pages.

This is a good start toward something we have needed for awhile.

moshe weitzman’s picture

drumm's suggestion looks sane to me.

krumms’s picture

Status: Active » Closed (fixed)

Closing this at long last. I was young, dumb and naive :P