Views 3 fields as list I am using Views 3 in Drupal 7 to show parent taxonomy terms using nested relationships.

This involves setting up a parent relationship, then a parent relationship of that parent, and then a parent relationship of that parent - this goes five levels deep and appears to be working well.

I have set the view to output the term name associated with each relationship, and with Views set to not render anything if the result is empty, I am being left with exactly what i need - a list of all (well, five levels right now) hierarchical parent terms. I have also set views to link each of these term names to their respective pages - and this is what is causing me problems...

Thing is, I want to see these fields as an unordered list. Setting the format option in Views to HTML list obviously sees all of my fields as part of the same result, and thus makes them the same list item.

The first thing I tried was to hide each field from display and rewrite everything using a custom text field:

&lt;ul&gt;
&lt;li&gt;[Term_Name_Level_1]&lt;/li&gt;
&lt;li&gt;[Term_Name_Level_2]&lt;/li&gt;
&lt;li&gt;[Term_Name_Level_3]&lt;/li&gt;
&lt;li&gt;[Term_Name_Level_4]&lt;/li&gt;
&lt;li&gt;[Term_Name_Level_5]&lt;/li&gt;
&lt;/ul&gt;


This works, but when I'm not five levels deep in the hierarchy (which is most of the time), I end up with empty li tags, as so:

(I put periods in here to show the effect, as the blank list items don't show here otherwise)


.
.
.
Grandparent term name
Parent term name


The next thing I tried was to rewrite each individual term name field, adding li tags around each one

&lt;li&gt;[Term_Name_Level_1]&lt;/li&gt;


then rewriting the output as follows

&lt;ul&gt;
    [Term_Name_Level_1]
    [Term_Name_Level_2]
    [Term_Name_Level_3]
    [Term_Name_Level_4]
    [Term_Name_Level_5]
&lt;/ul&gt;


This almost worked, as if there is no result, the whole field is left out including the tags. The problem here is that the link to the term page is wrapping around the li tags, like so:

&lt;ul&gt;
&lt;a href"#whatever"&gt;&lt;li&gt;Grandparent term name&lt;/li&gt;&lt;/a&gt;
&lt;a href"#whatever"&gt;&lt;li&gt;Parent term name&lt;/li&gt;&lt;/a&gt;
&lt;/ul&gt;


Thats obviously not what I need, so can anyone think of a way to get Views to output each field as a list item, but without printing empty tags when there is no result? I must say, I have a horrible feeling that I'm overlooking something!

Is there perhaps a way to get Views to output a raw link to each term page, so I can rewrite the lot? I see that there is a 'Taxonomy term: Term edit link' field available, but not a link to the actual term!

Thanks!
You can add the Term:ID and set the link to the term in 'rewrite results' as:

taxonomy/term/[tid]


If you want to keep the aliased URLs, you can use Global Redirect module.


  Once enabled, an alias provides a nice clean URL for a path on a site.
  However Drupal does not remove the old path (eg node/1234). The
  problem is that you now have two URLs representing the same content.
  This is dangerous territory for duplicate pages which can get you
  sandboxed by the search engines!