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 Question to Display Current Category

March 02, 2009 9:24pm

Subscribe [2]
  • #1 / Mar 02, 2009 9:24pm

    DanaK

    21 posts

    I’m working with the photo gallery module. This is the current code that I have:

    <ul>
                        {exp:gallery:category_list gallery="{embed:gallery_name}"}
                               {if category_id=={segment_3}}<div class="current_subcategory">{/if}
                                     <li><a href="http://{category_path={embed:gallery_name}/category}">{category_name}</a></li>
                               {if category_id=={segment_3}}</div>{/if}
                         {/exp:gallery:category_list}
                </ul>

    I’m trying to display each category_name and if the category is the current one, to include a <div class=“current_subcategory”> tag.

    The problem that I am having is that category_id is a number while {segment_3} has a “C” before it.

    I’ve tried to get around it several different ways but none have worked. Does anyone have any ideas?? Thanks in advance!
    ~Dana

  • #2 / Mar 03, 2009 1:54am

    John Henry Donovan

    12339 posts

    DanaK,

    Try the following conditional

    {exp:gallery:category_list gallery="{embed:gallery_name}"}
       {if segment_3=="C{category_id}"}
           <div class="current_subcategory">
                <li><a href="http://{category_path={embed:gallery_name}/category}">{category_name}{category_id}</a></li>
           </div>
       {if:else}
    <li><a href="http://{category_path={embed:gallery_name}/category}">{category_name}{category_id}</a></li>
       {/if}
    {/exp:gallery:category_list}
  • #3 / Mar 03, 2009 2:25am

    DanaK

    21 posts

    It worked! Thanks!

  • #4 / Mar 03, 2009 2:36am

    John Henry Donovan

    12339 posts

    Glad that worked for you. Feel free to post again if you have any more questions.

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

ExpressionEngine News!

#eecms, #events, #releases