I have a view that automatically shows the nodes in a certain term, filtered by the 'Taxonomy: Term Name' argument. I would like to print the term's description in the view's page header field. I'm using the following code for this (which doesn't work):

<?php
$name = arg(1);
$taxonomy_term = taxonomy_get_term_by_name($name);
print $taxonomy_term->description;
?>

It works fine using $tid (using the taxonomy_get_term($tid) function), but I would like to use the term's name, not the term's id as argument. The idea is to have url's in the form of http://example.com/tags/term_name with a short intro text (the term's description) on top of the page.

Could anyone point me in the right direction?

Thank you.

Comments

alexkessler’s picture

Hi!

I just read your post and (sorry) can't solve your probelm,
but maybe you could help me to solve mine.

I need to print the term id of arg(1).
Can't figure it out how to do this with taxonomy_get_term($tid) function. (totally php newbie)

You would help me a lot if you could paste me some code!

THX

tekken’s picture

yoroy’s picture

Status: Active » Closed (fixed)

Closing, this version of views is not supported anymore.

svihel’s picture

Probably little late for answer, but you could use the $tid variant and still have URL in decent shape. The answer is to use Pathauto module, which will create alias for taxonomy ID, so in url will be something like products/notebooks/amd but drupal engine will still see numeric term ID.