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.

Photo gallery category list order?

June 04, 2009 7:13pm

Subscribe [2]
  • #1 / Jun 04, 2009 7:13pm

    Ridge

    44 posts

    Moderator’s note: Split from this thread.

    Sorry to dredge up an old thread, but I’ve been using Robin’s code above, and would like to add a class of “current” to the <li> when on the right page. I’ve tried this to no avail:

    <li{if segment_3 == C{cat_id}} class="current"{/if}><a href="http://{path=gallery/category}C{cat_id}">{cat_name}</a></li>

    I’ve also tried it with and without quotes around the C{cat_id}, but whatever I do I can’t seem to get the class=“current” to output. I’m sure it’s something obvious, but I can’t see it. Anyone?

  • #2 / Jun 05, 2009 5:42am

    Ingmar

    29245 posts

    Are you using this within {exp:gallery:categories}? Also, I think the variable name is {category_id}.

  • #3 / Jun 05, 2009 11:29am

    Ridge

    44 posts

    Ingmar,

    In its original thread, my post made perfect sense. The code I was referencing that I’m using is this:

    <ul>
    {exp:query sql="SELECT c.cat_id, c.cat_name, c.cat_description FROM exp_gallery_categories AS c, exp_galleries WHERE c.gallery_id = exp_galleries.gallery_id AND exp_galleries.is_user_blog = 'n'AND exp_galleries.gallery_short_name = 'gallery'  ORDER BY c.cat_order ASC"}
    <li><a href="http://{path=gallery/album}C{cat_id}">{cat_name}</a></li>
    {/exp:query}
    </ul>

    to get the categories to output in the same order as they are in the admin interface. My problem comes when trying to apply a class to the currently viewed category.

  • #4 / Jun 08, 2009 11:43am

    Ridge

    44 posts

    Is this method (that Robin provided as a solution here) still the preferred method for outputting a list of gallery categories in the order in which they appear in the admin control panel? If there’s an easier way to do it that also allows me to add a class to the list item, I’m all ears. If not, my question still stands. 😊 Anyone?

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

ExpressionEngine News!

#eecms, #events, #releases