Skip to main content
Tweeted twitter.com/#!/StackExpression/status/309023653939511296
More example code
Source Link
JohnWBaxter
  • 1.7k
  • 14
  • 22

I've got a Matrix field with say 20 rows (could be 21).

I want to output those rows within but i want 2 rows in each .

Any idea how to accomplish this with the switch tag in Matrix? I'm trying some weird and wacky stuff but nothing is working as i want.

So markup i would want is:


<div>
{row 1 content}
{row 2 content}
</div>

<div>
{row 3 content}
{row 4 content}
</div>

<div>
{row 5 content}
{row 6 content}
</div>

<div>
{row 7 content}
</div>

And here is my current template code:

{exp:channel:entries channel="downloads" dynamic="no" disable="pagination|member_data|categories|category_fields" orderby="random"}
    <div>
{dl-downloads}

        <h4>{dl-download-title}</h4>
        <p>{dl-download-desc}</p>
        {switch="|</div><div>"}

{/dl-downloads}
    </div>
{/exp:channel:entries}

I've got a Matrix field with say 20 rows (could be 21).

I want to output those rows within but i want 2 rows in each .

Any idea how to accomplish this with the switch tag in Matrix? I'm trying some weird and wacky stuff but nothing is working as i want.

So markup i would want is:


<div>
{row 1 content}
{row 2 content}
</div>

<div>
{row 3 content}
{row 4 content}
</div>

<div>
{row 5 content}
{row 6 content}
</div>

<div>
{row 7 content}
</div>

I've got a Matrix field with say 20 rows (could be 21).

I want to output those rows within but i want 2 rows in each .

Any idea how to accomplish this with the switch tag in Matrix? I'm trying some weird and wacky stuff but nothing is working as i want.

So markup i would want is:


<div>
{row 1 content}
{row 2 content}
</div>

<div>
{row 3 content}
{row 4 content}
</div>

<div>
{row 5 content}
{row 6 content}
</div>

<div>
{row 7 content}
</div>

And here is my current template code:

{exp:channel:entries channel="downloads" dynamic="no" disable="pagination|member_data|categories|category_fields" orderby="random"}
    <div>
{dl-downloads}

        <h4>{dl-download-title}</h4>
        <p>{dl-download-desc}</p>
        {switch="|</div><div>"}

{/dl-downloads}
    </div>
{/exp:channel:entries}
better markup for example
Source Link
JohnWBaxter
  • 1.7k
  • 14
  • 22

I've got a Matrix field with say 20 rows (could be 21).

I want to output those rows within but i want 2 rows in each .

Any idea how to accomplish this with the switch tag in Matrix? I'm trying some weird and wacky stuff but nothing is working as i want.

So markup i would want is:


<div>
{row 1 content}
{row 2 content}
</div>

<div>
{row 3 content}
{row 4 content}
</div>

<div>
{row 5 content}
{row 6 content}
</div>

<div>
{row 7 content}
</div>

I've got a Matrix field with say 20 rows (could be 21).

I want to output those rows within but i want 2 rows in each .

Any idea how to accomplish this with the switch tag in Matrix? I'm trying some weird and wacky stuff but nothing is working as i want.

I've got a Matrix field with say 20 rows (could be 21).

I want to output those rows within but i want 2 rows in each .

Any idea how to accomplish this with the switch tag in Matrix? I'm trying some weird and wacky stuff but nothing is working as i want.

So markup i would want is:


<div>
{row 1 content}
{row 2 content}
</div>

<div>
{row 3 content}
{row 4 content}
</div>

<div>
{row 5 content}
{row 6 content}
</div>

<div>
{row 7 content}
</div>
Source Link
JohnWBaxter
  • 1.7k
  • 14
  • 22

Output matrix rows in sets of two

I've got a Matrix field with say 20 rows (could be 21).

I want to output those rows within but i want 2 rows in each .

Any idea how to accomplish this with the switch tag in Matrix? I'm trying some weird and wacky stuff but nothing is working as i want.