Listing Sub Categories of a Category related to an entry I've been scratching my head over this for awhile and I can't seem to solve it. 

What I'm after is the following.

I have various categories with numerous sub categories. I'd like to be able to display the sub categories of a category that is related to an entry which is how my navigation  is set up.

The code at the moment look like this...

{% set entries = craft.entries.find({ section: 'landingPages' }) %}
   {% for entry in entries %}
       &lt;li&gt;&lt;a href="{{ entry.url }}" class="{% set colour = entry.category.find() %}{% for category in colour %}{{ category.slug|striptags }}{% endfor %}" {% set colourTwo = entry.category.find() %}
           {% for category in colourTwo %} style="border-color: {{ category.supplierColour }}; color:{{ category.supplierColour }};" {% endfor %}&gt;{{ entry.title }}&lt;/a&gt;
           &lt;div class="sub {% set sub = entry.category.find() %}{% for category in sub %}{{ category.slug|striptags }}{% endfor %}"&gt;
           {% set drop = entry.category.find({ }) %}
               &lt;ul&gt;
               {% for category in drop %}
                  &lt;li&gt;&lt;a href="{{ category.url }}" title="{{ category.title }}"&gt;{{ category.title }}&lt;/a&gt;&lt;/li&gt;
               {% endfor %}
               &lt;/ul&gt;
           &lt;/div&gt;
        &lt;/li&gt;
    {% endfor %}


At the moment it's just generating the category which is selected within the entry, i've tried various variations on descendant commands and nothing seems to work.

Any help would be greatly appreciated.
Check out the documentation for craft.categories which should do what you need. In this example, I assume that 'landing pages' are the same as your level 1 categories, in which case you don't need to deal with the entries at all:

{% set categories = craft.categories.group('navCategories') %}

&lt;ul id="nav"&gt;
    {# using 'nav' and 'children' will create a recursive loop #}
    {% nav category in categories %}
        &lt;li&gt;
            {% if category.level == 1 %}
                &lt;a href="{{ entry.url }}" class="{{ category.slug }}" style="border-color: {{ category.supplierColour }}; color:{{ category.supplierColour }};" &gt;{{ category.title }}&lt;/a&gt;
            {% else %}
                &lt;a href="{{ entry.url }}" class="{{ category.slug }}"&gt;{{ category.title }}&lt;/a&gt;
            {% endif %}
            {% ifchildren %}
                &lt;div class="sub{{ category.level }} {{ category.slug }}"&gt;
                    &lt;ul&gt;
                        {% children %}
                    &lt;/ul&gt;
                &lt;/div&gt;
            {% endifchildren %}
        &lt;/li&gt;
    {% endnav %}
&lt;/ul&gt;


If you only want a certain number of levels then you can use a level filter. I.e:

{% set categories = craft.categories.group('navCategories').level('&lt; 3') %}


Update: If level 1 categories are not the same as your landing pages then you can access the category through entry.category.first, and then category decendants using: {% for category in category.descendants %}...{% endfor %} or {% nav category in category.descendants %}...{% endnav %} using the recursive method above.

&lt;ul id="nav"&gt;
    {% set entries = craft.entries.section('landingPages') %}
    {% for entry in entries %}
        {% set category = entry.category.first %}
        &lt;li&gt;
            &lt;a href="{{ entry.url }}" class="{{ category.slug }}" style="border-color: {{ category.supplierColour }}; color:{{ category.supplierColour }};" &gt;{{ entry.title }}&lt;/a&gt;
            &lt;ul class="sub {{ category.slug }}"&gt;
                {# using 'nav' and 'children' will create a recursive loop, if more levels are needed #}
                {% nav category in category.descendants %}
                    &lt;li&gt;
                        &lt;a href="{{ category.url }}" title="{{ category.title }}"&gt;{{ category.title }}&lt;/a&gt;
                        {% ifchildren %}
                            &lt;ul class="sub{{ category.level }}"&gt;
                                {% children %}
                            &lt;/ul&gt;
                        {% endifchildren %}
                    &lt;/li&gt;
                {% endnav %}
            &lt;/ul&gt;
        &lt;/li&gt;
    {% endfor %}
&lt;/ul&gt;


As a side-note: Keep in mind that you can also define css dynamically within the loop rather than defining it on the elements directly, if you wanted to.

{% set css %}
    a.{{ category.slug }} { 
        border-color: {{ category.supplierColour }}; 
        color:{{ category.supplierColour }}; 
    } 
{% endset %}
{% includeCss css %}