How to place mutiples of three divs into list items?
<p>I have content that is being outputting in endless divs. I'd like to surround mutiples of three within a list item, like this:</p>

<pre><code>&lt;li&gt;
   &lt;div&gt;content&lt;/div&gt;
   &lt;div&gt;content&lt;/div&gt;
   &lt;div&gt;content&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
   &lt;div&gt;content&lt;/div&gt;
   &lt;div&gt;content&lt;/div&gt;
   &lt;div&gt;content&lt;/div&gt;
&lt;/li&gt;
</code></pre>

<p>I'm trying to achieve this with the following code, but it's not working for some reason - it simply surrounds each div in its own li:</p>

<pre><code>$i = 1;
if($setting) {
    echo '&lt;li&gt;';
    echo '&lt;div&gt;My div&lt;/div&gt;';
    if ($i % 3 == 0) { 
        echo '&lt;/li&gt;&lt;li&gt;'; 
        }
    $i++;
    }
    echo '&lt;/li&gt;';
} 
</code></pre>

<p>Any ideas where I am going wrong?</p>
