当前位置: 动力学知识库 > 问答 > 编程问答 >

expressionengine - 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?

网友答案:

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}
分享给朋友:
您可能感兴趣的文章:
随机阅读: