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.

image gallery category display issue

February 15, 2008 2:02pm

Subscribe [2]
  • #1 / Feb 15, 2008 2:02pm

    matt960

    16 posts

    hi,

    I’m having a problem getting the thumbnail images to show for a particular category.. I’ve had a good search around but i’m still missing something!

    EE v 1.6.2

    The problem is probably best illustrated by this link: (click ‘Portraits > One’ then click any thumbnail)
    http://www.voodoo6.com/jo_metson_scott/index.php/

    I have a list of gallery categories on the home page.
    When a user clicks on a category name they are taken to a page showing the thumbnails for that particular category. (see the link above - please note only ‘portraits > one’ currently has entries, ‘portraits > two’ has a dummy entry to help debugging)
    When a user then clicks on one of the thumbnail images they are taken to another template to show the large version of the image they selected.

    My problem is that when a user has selected an image to view, the thumbnail area then only shows one image and not all the images from the category as the previous page.

    I think the problem is linked to the fact that when a user selects a thumbnail image to view, the URL is passed using {id_path=image_display} - which doesn’t give the following page (‘image_display’) a category reference in the URL? Is it possible somehow to set {category_path} and {id_path} so the URL has all the info it needs?

    I can get all the category images to show using dynamic=“off” and category=“3” but this is no longer dynamic and requires the category number to be hard coded which doesn’t meet the clients requirements.

    here is my code i am using for my displaying the thumbnails:

    <!-- Thumbnails -->
    {exp:gallery:entries gallery="jo_metson_scott" orderby="entry_id" columns="3" rows="3"}
    <div id="thumb_block">
    {entries}
    {row}
    <a href="http://{id_path=image_display}">{thumb_url}</a>
    {/row}
    {/entries}
    </div>
    {/exp:gallery:entries}

    i have a feeling i just overlooking something obvious, been staring at the same problem for hours now!
    many thanks
    matt

  • #2 / Feb 15, 2008 6:06pm

    Erin Dalzell

    790 posts

    Look into ‘dynamic=off’

  • #3 / Feb 15, 2008 7:57pm

    matt960

    16 posts

    hi erin, thanks for the reply
    i did have a play with ‘dynamic=off’ but it meant that the page was no longer dynamic! - if i use hard coded categories it means that the client can no longer add and remove categories themselves because the category numbers couldn’t change?

  • #4 / Feb 15, 2008 8:00pm

    Erin Dalzell

    790 posts

    No, it just means you have to do the work to get the images from the category in the URL.

  • #5 / Feb 15, 2008 9:14pm

    matt960

    16 posts

    i misunderstand? When using ‘dynamic=off’ is there another way to make the template know which category to show without hard-coding the category number in?

  • #6 / Feb 16, 2008 4:14pm

    matt960

    16 posts

    fixed it. (at least its working so far)

    as usual, the solution seems all too simple considering how long it took to figure it out..

    i used this code for the category link:

    <a href="http://{category_path=gallery_display/}{category_id}">{category_description}</a>

    which added the category id to the URL. I then used {segment_3} and dynamic=“off” to tell the gallery display page to always just display the category number shown in the URL

    {exp:gallery:entries gallery="gallery_name" orderby="entry_id" columns="3" rows="3" dynamic="off" category="{segment_3}"}

    the URL now is now telling the template which category to show.

    😊

    in case they are useful to anybody, some resources that helped me find answers:
    http://www.5pieces.com/blog/alternative_gallery_template/
    http://ellislab.com/forums/viewthread/64583/
    http://www.theblogstudio.com/index.php/v5/blogComments/more_on_using_segment_x_in_expression_engine/
    http://expressionengine.com/docs/templates/globals/url_segments.html

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

ExpressionEngine News!

#eecms, #events, #releases