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.

Count value being overruled in Gallery

July 17, 2008 5:24am

Subscribe [1]
  • #1 / Jul 17, 2008 5:24am

    I got the following:
    I’m using the gallery inside a weblog entry, this way url’s reflect the entry name and inside the weblog entry is a custom field that holds the Category ID for the gallery

    If I try to access the count value without embedding it into en entry but just displaying it in the gallery itself it is correct but when encapsulated inside the weblog entry it is always 1 and does not reflect the current image count.

    How can this be solved?

    {exp:weblog:entries limit="1" disable="trackbacks" rdf="off" track_views="one" weblog="media"}
    
    {assign_variable:gallery_name="galleries"}
    {exp:gallery:entries gallery="{gallery_name}" category="{Gallery}" offset="2" orderby="screen_name"  sort="desc" columns="1" rows="65"}
    {entries}
    {row}
    {image_url}
    {if '{count}'== '6'}
              {embed="galleries/uitgevers_{custom_field_one}"}
    {/if}
    {if '{count}'== '9'}
              {embed="galleries/uitgevers_{custom_field_one}"}
    {/if}
    {/row}
    {/entries}
    {/exp:weblog:entries}
    
    {/exp:gallery:entries}
  • #2 / Jul 17, 2008 10:13am

    Robin Sowell

    13255 posts

    You’re right- it’s because it’s nested.  There are only two ways around it that I can think of.  1. use php parsed on output- do the counting that way.  2. move the gallery tag to its own template, then embed it inside the weblog tag.  You can pass the cat id in an embed variable.  That should work.

    Make sense?

  • #3 / Jul 17, 2008 10:36am

    going to try that, tnx for the tip. Did not think of the pass value and embed

  • #4 / Jul 17, 2008 10:50am

    Robin Sowell

    13255 posts

    It adds a wee bit of overhead, but is actually the cleanest way to do it- you no longer have to worry about variable conflicts.  Give a yell back when it’s working and I’ll close this one out.  And if you run into trouble- it’ll still be open.

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

ExpressionEngine News!

#eecms, #events, #releases