I just started with Drupal. Is there a way to put the name of the taxonomy the story belongs to in the title as well.. like "Crazy Ideas | Jumping from the building | example.com", the first being the taxonomy.

thanks

Comments

cursor’s picture

I figure that I would need to change phptemplatengine.. but what? hmm any clues?

jmengle’s picture

You need to edit the chameleon.theme file.
Find the "chameleon_node" function. This function begins at the line function chameleon_node($node, $main = 0, $page = 0) {

You'll need to add the code in this function, the best place is probably right before the line return $output;

1) This is assuming that you only have one taxonomy term per node, or you just want to include one term in the title.

$title = drupal_get_title();
if ($terms[0])
  $title = $terms[0]." | ".$title;
drupal_set_title($title);

There's at least one problem with this, though; if you are at a page listing all the nodes for a term (for example "terms/1"), then it looks kinda funny, because the title ends up being: "term | term | sitename".

2) This is if you want to list all the terms for the node in the title:

$title = drupal_get_title();
$terms_list_for_title = '';
foreach ($terms as $term_for_title)
  $terms_list_for_title .= $term_for_title." | ";
$title = $terms_list_for_title.$title;
drupal_set_title($title);

I haven't actually tested this one, but it should work.

Let us know if this worked or not, or if you have any other questions.

Hope this helps...