I'm trying to theme the taxonomy page in Drupal 6 with a Zen subtheme. What I'm trying to do is create a custom teaser and page title, using the PageTitle and Nodewords modules. I've mocked up what I want using the contemplate module, but it doesn't have access to the node title.

Contemplate page->teaser modification

<h2 class="teaser_title"><?php
if (!empty($node->page_title)){
 print check_plain($node->page_title);
}
else {
 print check_plain($node->title);
}
 ?></h2>
<p class="teaser_description"><?php
if (!empty($node->nodewords['description'])){
 print $node->nodewords['description'];
}
else {
print rtrim(strip_tags($node->teaser),150);
}
 ?>
</p>

Is the best way to handle this modification to create some extra variables in a MYTHEME_preprocess_node function (say $taxonomy_title, and $taxonomy_teaser) and then create a node-taxonomy.tpl.php that uses these variables? I don't want to change all the node.tpl.php files with the modified title. Is there a cleaner, more Dupally way to do this? MYTHEME_preprocess_taxonomy isn't a valid theming function...right? Just trying to get my head around this code.

Thanks,

Gregg Short
GShort.com Web Marketing and Design
a GShort.com, LLC Company
gregg - at- gshort dot com
(330)465-7531

Comments

OneTallShort’s picture

Here's the answer that I came up with:

function MYTHEME_preprocess_node(&$vars, $hook) {
  $node = $vars['node'];
  if (arg(0) == 'taxonomy'){
    if (!empty($node->page_title)){
		$vars['title'] = check_plain($node->page_title);
	}
	if (!empty($node->nodewords['description'])){
     $vars['content'] =  $node->nodewords['description'];
	}
	else {
 	$vars['content'] = rtrim(strip_tags($node->teaser),150);
	}	
  }

}

No need for a special node.tpl.php