Reputation: 11187
I have a page that has a single category applied to it, for this example, "Self Help Books".
I want to put a place on content type that display a "view all [insert category here]" that links to that category listing page. I was hoping I could do something like:
<a href=%taxonomyLink:books--self-help-books%>view all%taxonomy:books%</a>
and it would pull in the category for anything using that content type. I'm using the panels modules so I had planned on placing this in a panel the content type was using. Is any of this possible?
I thought about creating a block and placing that in a panel in the panels module.
(also, if you can't tell, I'm pretty fresh to Drupal.)
Upvotes: 0
Views: 681
Reputation: 985
You don't need to write code for this. If you using panels .. Find a way to put a right relationship in context for needed taxonomy term, after that you will have all the needed tokens (%placeholders) to build your content.
Upvotes: 0
Reputation: 821
you can use simple drupal api function to achieve that.
here is the code:
$term = taxonomy_term_load(123);
$link = l($term->name, 'taxonomy/term/' . $term->tid);
you can also find more about l() here https://api.drupal.org/api/drupal/includes%21common.inc/function/l/7
Upvotes: 3
Reputation: 1
This Drupal docs page lists several modules that assist in displaying related content, via a few different methods.
As of now, the most stable 7.x compatible terms-based module appears to be Similar by Terms.
There are ways to achieve this without installing an additional module, but this will satisfy your requirements as-is.
Upvotes: 0