ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

gallery with categories

January 31, 2012 11:25am

Subscribe [1]
  • #1 / Jan 31, 2012 11:25am

    redfred

    141 posts

    Probably an easy one but can’t find the answer…

    I’ve got a Gallery channel and want the categories to be subheadings for the relative group of images.

    Can you tell me how I can do this?

    Currently I’m getting the category name and just one image several times, rather than the category name with several images underneath, using this code:

    {exp:channel:entries channel="gallery"}
    
    <div class="gallery_clear"> 
      
        <a href="http://{gallery-image}%22name=%22{category_name}%22&gt&lt/a&gt" title="{title}">__ {gallery-image}__ {path}_small/{filename}.{extension} __ {/gallery-image}__ </a>
    
    </div>
    
    {/exp:channel:entries}
  • #2 / Feb 01, 2012 2:40pm

    Kevin Smith

    4784 posts

    Hi redfred,

    Sounds like Category Archive might be just the tag you’re looking for. It’ll let you display entries within a category using that category as a heading. Does that work for you?

  • #3 / Feb 02, 2012 4:12am

    redfred

    141 posts

    That’s it, thanks.
    This was what I’ve finally used:

    {exp:channel:category_archive channel="gallery" style="linear"}
    {categories}
    
    <div class="gallery_clear"> 
    <h2>{category_name}</h2>
    
    <p></ul>                                    <br />
    {exp:channel:entries channel="gallery" category="{category_id}"}<br />
    <li> <br />
    <a href="http://{gallery-image}rel=lightboxam">" title="{title}"]{gallery-image}{path}_small/{filename}.{extension}{/gallery-image}</a><br />
    </li><br />
    {/exp:channel:entries}<br />
    </ul><br />
    </div><br />
    {/categories}</p>
    
    <p>{/exp:channel:category_archive}

  • #4 / Feb 05, 2012 8:32am

    Sean C. Smith

    3818 posts

    redfred,

    Glad to see that Kevin was able to get you all sorted out. Is there anything else I can assist you with?

    Sean

  • #5 / Feb 06, 2012 3:57am

    redfred

    141 posts

    That’s all for now, thanks!

  • #6 / Feb 07, 2012 8:39pm

    Sean C. Smith

    3818 posts

    I’m going to close out this thread, but feel free to post again when you have more questions.

    Sean

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases