How to print whole free tagging in contemplate?

Comments

jrglasgow’s picture

Status: Active » Closed (duplicate)

This is a duplicate of #183106: insert taxonomy links as usual ....
Here is the solution I suggest. Place this code in you template. You can have it display however you need. If you need some help with the display let me know.

<div class="links">
    <ul class="links inline">
      <?php
        foreach($node->taxonomy as $term){
          print '<li class="first last taxonomy_term_'.$term->tid.'"><a href="taxonomy/term/'.$term->tid.'" rel="tag" title=""
          class="taxonomy_term_'.$term->tid .'">'.$term->name.'</a></li>';
       }
      ?>
    </ul>
  </div>
nainainai’s picture

Wow it work great! Only if i can get it to display with a comma, then everything should be looks great. Thanks a lot

jrglasgow’s picture

to print with a comma try this:

  <div class="links">
    <ul class="links inline">
      <?php
        $count = 0;
        foreach($node->taxonomy as $term){
          print '<li class="first last taxonomy_term_'.$term->tid.'">'.(($count > 0) ? ', ' : '').'<a href="taxonomy/term/'.$term->tid.'" rel="tag" title=""
          class="taxonomy_term_'.$term->tid .'">'.$term->name.'</a></li>';
          $count++;
       }
      ?>
    </ul>
  </div>
nainainai’s picture

Status: Closed (duplicate) » Closed (fixed)

thanks work perfectly

nainainai’s picture

small problem! any link with space it wont work right.