List Categories AND their associated entries I'm trying to create a category driven gallery. My setup (right or wrong) is this:-

Users create a new entry within a Structure, title it, add photos and then assign the entry to a pre-defined gallery category.

My idea is that when a visitor lands on the 'Gallery' page they see a 'grid' of latest photos (this is a question which might appear here later), with a navigation on the side which allows them to browse the other galleries (categories).

So, how do I list out the categories and associated entries for this navigation?

Example:


Category Title One


Title of the entry1
Title of the entry2
Title of the entry3

Category Title Two


Title of the entry4
Title of the entry5

Category Title Three


Title of the entry6
Title of the entry7
Title of the entry8

Category Title Four


Title of the entry9



I don't want the Category Titles to be links, just the entries within them.

I hope this makes sense and someone can provide a solution.

Many thanks

Martin
Something along the line of this should do that:

&lt;ul&gt;
    {% for category in craft.categories.group('categoryGroupHandle') %}
    &lt;li&gt;
        {{ category.title }}
        {% for entry in craft.entries.section('sectionHandle').relatedTo(category) %}
            {% if loop.first %}&lt;ul&gt;{% endif %}
                &lt;li&gt;&lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;&lt;/li&gt;
            {% if loop.last %}&lt;/ul&gt;{% endif %}
        {% endfor %}
        &lt;/ul&gt;
    &lt;/li&gt;
    {% endfor %}
&lt;/ul&gt;


Probably some bugs in here, but should be enough to get you started.

Also probably smart to wrap this in {% cache %} tags, as it probably will trigger a lot of database queries.