I have a D7 view page which is getting filtered by a Contextual Filter on a taxonomy term related to nodes. I simply wanted to display the relevant taxonomy term's description in the view header or a separate block, but I couldn't get it to work with a separate view using a contextual filter on the URL. The biggest hang up was getting it to work with URLs with dashes instead of spaces in the terms.

So I put the following code into a separate block:

<?php $current = taxonomy_get_term_by_name(str_replace('-', ' ', arg(1))); ?>
  <?php $key = current(reset($current)) ; ?>
<?php if ($current): ?>
    <div class="taxonomy-description">
        <?php print( $current[$key]->description) ; ?>
    </div>
<?php endif; ?>

This seems very kludgy. What's a better way to do this in D7?

Comments

deelite’s picture

Did you get a solution for that?

adam_b’s picture

- add a relationship to the taxonomy term: "terms on node"
- create an attachment display
- make the attachment field the term description