tpow
tpow

Reputation: 7886

Working with loops in Expression Engine Templates

I have an area in my Expression engine site where I have a piece of content that contains a set of images. I'm trying to setup the template so that I can use a jQuery image gallery. I'm trying to get the first image to be normally sized, but each image after that, I'd like to use HTML to scale the image down. The problem is, using the Expression engine template "Loop", I can't figure out how to render the images separately. So, I have this:

                  {if press_photo}
                    <div class="align_right image">
                        {press_photo limit='4'}
                            <img src="{url}" alt="{alt_text}" />
                        {/press_photo}
                    </div>
                  {/if}

With this, each photo is rendered the same. How can I have two loops where the first loop contains the first image, and the second loop contains the rest?

Upvotes: 0

Views: 1654

Answers (1)

Philip Zaengle
Philip Zaengle

Reputation: 947

You could have two loops one with limit="1" and another with limit="3" offset="1" but that won't be as efficient as using the {count} variable with something like this.

{if count == 1}
    do this
{if:else}
    do that
{/if}

Upvotes: 5

Related Questions