1

I'm sure this is an easy one to answer.

I have a matrix field which I am using together with CE Image to create a gallery. It contains two columns and a variable number of rows depending on how many images it contains.

Like so:

matrix

{gallery limit="1"}

    {exp:ce_img:pair src="{image_url}" crop="yes|smart_scale" width="420" height="315" allow_scale_larger="yes" filter="sharpen" limit="1" quality='60' add_dims="no"}

    <img src="{made}" alt="{title}"/>

        {/exp:ce_img:pair}

{/_gallery}

But I want the image to be the one that is "1" in the Image Order Number (image_order) column.

3
  • You know that Matrix rows are drag and drop to reorder, right? So unless you need a secondary sort order you could just reorder the rows in the Publish form and rely on the actual order of the Matrix field instead of creating an "order" column. – Alex Kendrick Apr 25 '13 at 14:19
  • yep, that would fine, had it not been for the fact that there are over 2000 entries! Wouldn't want to do that manually! :) – shorn Apr 25 '13 at 18:21
  • I see. Part of your import project. Good call! – Alex Kendrick Apr 25 '13 at 19:03
3

Well that was simple! just added the orderby="image_order" parameter to the matrix tag pair.

I had tried that originally, but it was using the already cached images. Once they were deleted out, it regenerated the right ones.

:)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.