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 - Putting categories and Entry thumbs on 1 page

May 14, 2008 2:58am

Subscribe [2]
  • #1 / May 14, 2008 2:58am

    tubes

    10 posts

    I’m trying to set up a gallery that lists all of the category names and then all the thumbnails for that category underneath in a row(s). I don’t need to display any of the other information such as date or title.

    I’ve managed to strip out all the excess code from the gallery index page to just display the categories but I don’t know how to integrate the thumbnails under each category or if it’s even possible.

    Here is the code that displays the Categories - so far so good:

    {exp:gallery:categories gallery="{gallery_name}"}
    
    {category_row}
    
    {row_start}<div>{/row_start}
        
    {row}
    <a href="http://{category_path=personal/category}">{category}</a>
    {category_description}
    
    {/row}
        
    {row_end}</div>{/row_end}
    
    {/category_row}
    
    {/exp:gallery:categories}

    But how can I display the thumbs from each category underneath? I’ve tried embedding the exp:gallery:entries info from the categories template withing the categories code but that doesn’t work. Can you even have a tag set within an different tag set?

    Ultimately, I’m looking for what you see in the screenshot - eventually with lightbox functionality. Any help or advice is appreciated, thanks.

  • #2 / May 14, 2008 9:49am

    Mikee Bee

    179 posts

    I can’t remember exactly how you do it using entries & categories tags I think (maybe someone can correct me) you have to include using {embed} the entries tag inside the categories tag I use a query to give the same results like this…

    {exp:gallery:categories gallery="gallery"}
            {category_row}{row}
    
            {exp:query sql="SELECT cat_folder FROM exp_gallery_categories WHERE gallery_id = '1' AND cat_id = '{cat_id}' "}
    
            {exp:gallery:category_name}<h2><a href="http://{category_path=gallery/listing}">{category}</a></h2><p>{exp:gallery:category_name}</p>
    
    <p>        {if category_description}{category_description}{/if}</p>
    
    <p>        <ul><br />
            {exp:query sql="SELECT * FROM exp_gallery_entries WHERE cat_id = '{cat_id}' LIMIT 5"}<br />
            <li><br />
            <a href="http://{site_url}images/gallery-images/{if" rel="lightbox" title="{title}">"]_        /phpThumb/phpThumb.php?src={site_url}images/gallery-images/{if cat_folder != _        </a></li><br />
            {/exp:query}{/exp:query}<br />
            </ul></p>
    
    <p>        {if total_files > 5}<strong><a href="http://{category_path=gallery/listing}">View all {total_files} images »</a></strong>{/if}</p>
    
    <p><br />
            {/row}{/category_row}<br />
    {/exp:gallery:categories}

    The image link seems to be quite messy but it uses lightbox to get the main image and PhpThumb to produce the thumbnail from the same image. You can see there is a limit of 5 but just take that off to list all the entries. You can see it in action here (bare in mind there is only 1 category at the moment)

    Hope this helps

  • #3 / May 14, 2008 2:07pm

    tubes

    10 posts

    That looks exactly like what I wanted to do. I haven’t looked ove the code or tried it yet but I think it will work! Thanks so much!

  • #4 / May 14, 2008 3:00pm

    Mikee Bee

    179 posts

    Hey no worries dude. Gimmi a shout if you get stuck

  • #5 / May 14, 2008 3:29pm

    tubes

    10 posts

    Well, I think I’ve almost got it. I managed to get the Categories and the descriptions and the links to show up but I can’t figure out how to get the links to display the thumbs. I took out the php thumb scaling path you put in and I thought i had it aiming to the right place but they aren’t showing up. My thumbnails are in the same folder as the large images with the _thumb suffix. Here is where I am at now (obviously I need a custom css class for the list and to add the lightbox script). Once the thumbs show up, it’s all set. Any ideas?

    Site

    Here is my code so far:

    {exp:gallery:categories gallery="personal"}
            {category_row}{row}
    
            {exp:query sql="SELECT cat_folder FROM exp_gallery_categories WHERE gallery_id = '1' AND cat_id = '{cat_id}' "}
    
            {exp:gallery:category_name}<h2><a href="http://{category_path=gallery/listing}">{category}</a></h2><p>{exp:gallery:category_name}</p>
    
    <p>        {if category_description}{category_description}{/if}</p>
    
    <p>        <ul><br />
            {exp:query sql="SELECT * FROM exp_gallery_entries WHERE cat_id = '{cat_id}' LIMIT 100"}<br />
            <li><br />
            <a href="http://{site_url}images/personal/{if" rel="lightbox" title="{title}">"]_        {site_url}images/personal/{if cat_folder != _        </a></li><br />
            {/exp:query}{/exp:query}<br />
            </ul><br />
            {/row}{/category_row}<br />
    {/exp:gallery:categories}

  • #6 / May 14, 2008 3:39pm

    Mikee Bee

    179 posts

    You need to take the rest of the phpthumb stuff out plus if your thumbnails are different files you will need to have the url to the thumbnail as per the docs

    So your img tag should look like this

    {thumb_url}

    I think thats right anyway! Because I use phpthumb for thumbnails I only have one image to deal with instead of the main image and the thumbnail so I hope this works!

  • #7 / May 14, 2008 3:53pm

    tubes

    10 posts

    I figure a lot of that had to come out but wasn’t sure what to remove! Sorry, I’m really new to this.

    It’s so close but it’s still spitting out {thumb_url} on the page instead of the appropriate image. My thumbs are in the same folder with the _thumb extension.

    http://s36386.gridserver.com/images/personal/ontheroad/airplane.jpg
    http://s36386.gridserver.com/images/personal/ontheroad/airplane_thumb.jpg

    It doesn’t seem to be able to figure that out and I’m not sure what to do to make it get that.

  • #8 / May 14, 2008 3:57pm

    Mikee Bee

    179 posts

    Hmm strange, how about

    {site_url}images/personal/{if cat_folder != 

    Seems like a long way of doing it but….

  • #9 / May 14, 2008 4:19pm

    tubes

    10 posts

    Well, I’m not sure if I did what you were saying but what I did (after a dozen different things) was just copy the link and add the _thumb and now it works. Probably more complex than necessary but that’s OK. Phew!

    Thank you so much for your help on this. You’re a life saver.

    {site_url}images/personal/{if cat_folder != 

    http://s36386.gridserver.com/index.php/personall

  • #10 / May 14, 2008 4:28pm

    Mikee Bee

    179 posts

    Yep thats it! Glad I could help

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

ExpressionEngine News!

#eecms, #events, #releases