Closed (fixed)
Project:
Views (for Drupal 7)
Version:
4.7.x-1.6-beta5
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
11 May 2007 at 15:35 UTC
Updated:
10 Sep 2009 at 19:52 UTC
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
Comment #1
alexkessler commentedHi!
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
Comment #2
tekken commentedThis may help: http://drupal.org/node/276341
Comment #3
yoroy commentedClosing, this version of views is not supported anymore.
Comment #4
svihel commentedProbably 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.