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 thumbnails and counts not displaying

September 01, 2008 2:28am

Subscribe [5]
  • #1 / Sep 01, 2008 2:28am

    ChargePositif

    7 posts

    Hello Folks,

    I’ve been trying to get a display so that I have:

    Gallery Category Name
    <thumb 1> <thumb 2> <thumb 3> <thumb 4>
    11 Pictures | 27 Views | 2 Comments

    Here is the code I’m trying to get to work:

    {exp:gallery:categories gallery="{gallery_name}" sort="asc"}
        {category_row}
            {row_start}<div class="content-full">{/row_start}
            {row}
    
                <h2>{category}</h2>
    
    <p>            <div class="content-full"><br />
                    {exp:gallery:entries gallery="{gallery_name}" category="{category_id}" limit="4"}<br />
                        {entries}<br />
                            {row}<br />
                                {thumb_url}<br />
                            {/row}<br />
                        {/entries}<br />
                    {/exp:gallery:entries}<br />
                </div></p>
    
    <p>            <br />
                    {total_files} Pictures | <br />
                    {total_views} Views | <br />
                    <a href="http://">{total_comments} Comments</a><br />
                </p>
    
    <p>        {/row}</p>
    
    <p>        {row_end}</div>{/row_end}</p>
    
    <p>    {/category_row}<br />
    {/exp:gallery:categories}

    Here is what the above code generates:

    <div class="content-full">
        <h2>Grand Am @ VIR October 5, 2007</h2>
    
    <p>    <div class="content-full"><br />
            " width=<br />
            " width=<br />
            " width=<br />
            " width=<br />
        </div><br />
        <br />
            Pictures | <br />
            Views | <br />
            <a href="http://">1 Comments</a><br />
        </p>
    
    <p></div><div class="content-full"><br />
        </p><h2>Nadia and Brad's Wedding Rehearsal</h2>
    
    <p>    <div class="content-full"><br />
            " width=<br />
            " width=<br />
            " width=<br />
            " width=<br />
        </div></p>
    
    <p>    <br />
            Pictures | <br />
            Views | <br />
            <a href="http://">1 Comments</a><br />
        </p>
    
    <p></div><div class="content-full"><br />
        </p><h2>Hillsborough Snow January 20, 2008</h2>
    
    <p>    <div class="content-full"><br />
            " width=<br />
            " width=<br />
            " width=<br />
            " width=<br />
        </div></p>
    
    <p>    <br />
            Pictures | <br />
            Views | <br />
            <a href="http://">1 Comments</a><br />
        </p>
    
    <p></div>

    As you can see, inside {exp:gallery:entries}{/exp:gallery:entries} tags all of the thumbnail variables except the {thumb_url} are being properly replaced. You can also see that the {total_files} and {total_views} fields, associated with, I would expect, {exp:gallery:categories}{/exp:gallery:categories}, are not replaced with the proper counts.

    I’ve probably missed something obvious, but what’s odd is that some variables are replaced properly while others are not.

    Thanks,

    - John

  • #2 / Sep 01, 2008 2:07pm

    Sasha

    85 posts

    With regards to {thumb_url}, are you sure that under gallery > Preferences > Thumbnail Preferences, you have it set to YES for “Create Thumbnail Upon Upload?”, and had that set to YES when you uploaded the images currently in your gallery?

    I once forgot to turn this on after I’d turned it off, and it caused {thumb_url} to generate empty for me just like it is for you.

    With regards to the {total_files} and {total_views}, does it work okay if you’d move it above the gallery entries code, just to test it? I wonder if the embedded tags are somehow messing things up for you…..

  • #3 / Sep 01, 2008 8:39pm

    Sue Crocker

    26054 posts

    What I’d do is take some example code that works and then change it to fit your needs.
    EEDocs:// Gallery Categories

  • #4 / Sep 01, 2008 10:20pm

    ChargePositif

    7 posts

    With regards to {thumb_url}, are you sure that under gallery > Preferences > Thumbnail Preferences, you have it set to YES for “Create Thumbnail Upon Upload?”, and had that set to YES when you uploaded the images currently in your gallery?

    I once forgot to turn this on after I’d turned it off, and it caused {thumb_url} to generate empty for me just like it is for you.

    Yep, that’s the first thing I checked, then I checked the directory where the images, thumbs and medium sized image are stored. All was well there. The thumbnails display when I use the default template.

    With regards to the {total_files} and {total_views}, does it work okay if you’d move it above the gallery entries code, just to test it? I wonder if the embedded tags are somehow messing things up for you…..

    Yep. Before I nested the gallery entries I checked to make sure that things displayed as I expected. It wasn’t until I nested the gallery entries within the gallery categories that things stopped working.

    - John

  • #5 / Sep 01, 2008 10:28pm

    ChargePositif

    7 posts

    What I’d do is take some example code that works and then change it to fit your needs.
    EEDocs:// Gallery Categories

    Sue,

    Thanks. I started with the default template and started mapping it into CSS I am using for my site. It stopped working as I though it would when I nested the gallery entries inside the gallery categories block of code.

    I am trying to have each category look like a blog entry, but instead of text, there are up to four thumbnails. Clicking on the thumbnails will bring up a lightbox with the four pictures. Eventually I will make the category name a link to the full set of pictures and place a link below the thumbnails that will also take you to the full set of pictures.

    - John

  • #6 / Sep 02, 2008 5:41am

    Sasha

    85 posts

    Yep. Before I nested the gallery entries I checked to make sure that things displayed as I expected. It wasn’t until I nested the gallery entries within the gallery categories that things stopped working.

    - John

    Aha! It’s the nesting that is messing things up then! Have you tried putting the entire gallery entries code block into a seperate template, and embedding it? You’ll need to pass the category ID on using embed variables - like for example:

    Main template:

    {embed="site/fourthumbs" cat_id="{category_id}"}

    Embedded template (assuming you called it ‘fourthumbs’, for example - if not, change it in the above code too):

    {exp:gallery:entries gallery="{gallery_name}" category="{embed:cat_id}" limit="4"}
                        {entries}
                            {row}
                                {thumb_url}
                            {/row}
                        {/entries}
                    {/exp:gallery:entries}

    Untested, but hope it helps anyway!

  • #7 / Sep 02, 2008 4:08pm

    Lisa Wess

    20502 posts

    Yes, like Sasha said, you’re running into conflicts from unsupported nesting. An embed should fix that up nicely. =) Thank you, Sasha!

  • #8 / Sep 05, 2008 12:43am

    ChargePositif

    7 posts

    Sasha,

    That was a great idea, and you may now consider it tested! Thank you.

    Here is the actual code:

    <div class="content-full">
        {exp:gallery:entries gallery="{embed:nj_gallery_name}" category="{embed:nj_category_id}" limit="4"}
            {entries}
                {row}
                    {thumb_url}  
                {/row}
            {/entries}
        {/exp:gallery:entries}
    </div>

    Thank you so much!

    - John

    Yep. Before I nested the gallery entries I checked to make sure that things displayed as I expected. It wasn’t until I nested the gallery entries within the gallery categories that things stopped working.

    - John

    Aha! It’s the nesting that is messing things up then! Have you tried putting the entire gallery entries code block into a seperate template, and embedding it? You’ll need to pass the category ID on using embed variables - like for example:

    Main template:

    {embed="site/fourthumbs" cat_id="{category_id}"}

    Embedded template (assuming you called it ‘fourthumbs’, for example - if not, change it in the above code too):

    {exp:gallery:entries gallery="{gallery_name}" category="{embed:cat_id}" limit="4"}
                        {entries}
                            {row}
                                {thumb_url}
                            {/row}
                        {/entries}
                    {/exp:gallery:entries}

    Untested, but hope it helps anyway!

  • #9 / Sep 05, 2008 1:16pm

    Greg Aker

    6022 posts

    John:

    Is everything up and running the way you want it to be now?

    -greg

  • #10 / Sep 06, 2008 12:12am

    ChargePositif

    7 posts

    John:

    Is everything up and running the way you want it to be now?

    -greg

    With respect to the thumbnails and counts displaying, yes.

    Regarding the rest of the site, ummm, no, but that’s me, not EE.  😊

    - John

  • #11 / Sep 06, 2008 1:25am

    Greg Aker

    6022 posts

    John,

    I’m glad you have your current issue resolved.

    Please hit the tech support forums & the community “how to” as you run into any more issues.  😊

    Thank you and happy EE-ing!!  😉

    -greg

    ps.  Sasha, thanks for the assist!  😊

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

ExpressionEngine News!

#eecms, #events, #releases