0

I'm using EE to light up a HTML email template, so, not surprisingly, I've had to resort to some trickery to get the layout working in Outlook.

Basically, I have a table, and I need a cell in the table to alternate between the left and right side for every other matrix row:

{my_matrix_field}
    <table cellpadding="0" cellspacing="0" border="0" width="210" align="{switch='left|right'}">
        <tr>
            {if row_count:even}
                <td width="10"></td>
            {/if}

            <td width="200">
                <img src="{image}" alt="{alt}" width="200" height="200" />
            </td>

            {if row_count:odd}
                <td width="10"></td>
            {/if}
        </tr>
    </table>
{/my_matrix_field}

Possible?

1 Answer 1

4

Try to use multiple switch tags.

{my_matrix_field}
    <table cellpadding="0" cellspacing="0" border="0" width="210" align="{switch='left|right'}">
        <tr>
            {switch='|<td width="10"></td>'}
            <td width="200">
                <img src="{image}" alt="{alt}" width="200" height="200" />
            </td>
            {switch='<td width="10"></td>|'}
        </tr>
    </table>
{/my_matrix_field}
1
  • It works! You should update your example and swap the code in the switch tags, so the top cell is even and the bottom is odd.
    – kmgdev
    May 30, 2013 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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