I'm not sure if I'm missing something simple, but I'm stumped, regardless.

I've created a site where I post photos. I have a content type called 'Photos' and for each entry, in addition uploading the image itself, I have a series of taxonomies: Country, State, City, Neighborhood, Color, and Tags. I have all of that working fine and I can display the associated taxonomy terms with each photo.

Now I'd like to display a list of all the terms of each Taxonomy in the footer of my site (for example, there would be a block with a label called 'Cities' and then below would be a list of all the cities in the entire taxonomy).

I've tried creating a View that contains the terms and assign it as a block. This works, and I can display the Block View through my subtheme (Fusion) template. Unfortunately, all of the terms will only display as a list (with a lot of nested DIVs around each term). My goal is to display all the terms inline with only a space delimiter (I'm taking care of making them stand apart visually through my CSS styling).

Does anyone know how to display them inline rather than a list? Or, is there a better way to render this output (not using views)? I'm not a programmer, so I'd prefer to keep it in the configuration if possible. It seems like it should be something simple (I used to do this simply back when I used Movable Type), but it appears to be a daunting task.

To be clear, I'm trying to display all of the terms for a taxonomy, not just those associated with a node.

Thoughts?

Comments

griz’s picture

I know this isn't exactly what you're after, but it might help.
I have a view in which I've outputted the terms for that row inline. The filename is views-view-field--[view_name]--page-1--[field-name]-value.tpl.php
The "page" part makes it display on the first "page" display in the list of displays on the view's edit page.

  <div class="field-label-inline<?php print($delta ? '' : '-first')?>">
    <?php print t($label) ?>:&nbsp;</div>
  
    <?php $count = 1;
          $total = count($items);
      foreach ($items as $item) :
      if (!$item['empty']) : ?>
        <span class="field-item">

          <?php if ($count != $total) {$commas = ', ';} else {$commas = '';} 
                print($item['view'] . $commas); ?>

        </span>
      <?php $count++;
      endif;
    endforeach;?>
  </div>

This worked for me because I'm using Content Taxonomy Fields.

And I've just realised that you're not stuck in the past like I am and therefore aren't using D6.
The concept should be the same - copy the views-view-field.tpl.php into your theme folder. Count how many terms there are, then whack a space on the end of each term in a loop with an incrementing var at the end until it reaches the same as the number of terms.

ErgunK’s picture

Without seeing your site it is hard to make a suggestion but basically to make a text inline with a space after it could be possible with this CSS code:

.your-terms-class {
display: inline;
padding-right: 3px;
}

If you want to add some special delimiter like comma you can add this code to your CSS file:

.your-terms-class:after {
content:",";
}

PS: Replace "your-terms-class" with your term's class or ID. If you use ID make sure you put "#" instead of "." before the ID.


Mediasaur | http://www.mediasaur.com/en | http://twitter.com/mediasaur


Before asking for help, please read this http://slash7.com/2006/12/22/vampires/ and don't be a "Help Vampire". :)
Vali Hutchison’s picture

Can also add:

.your-terms-class:last-child:after {
  content:"";
}

to remove the comma after the last item.

birdahonk’s picture

Thank you griz and Mediasaur.

I opted for a version that used some of the CSS ideas. I might go the php route later on when I have a little more time.

Thanks for the advice, it helped a lot.

bufflex’s picture

Can confirm that this module does exactly what everyone is looking for.

Just make sure to download the dev version and not the alpha because at the time of writing this comment, the alpha version is broken if you have any separator like comma(,) selected. The dev version does exactly what it's supposed to without any problems.