Note that there are some explanatory texts on larger screens.

plurals
  1. POcreate new ul after every 13 li elements
    primarykey
    data
    text
    <p>First of all, I don't know how to count in php, maybe someone could recommend me a good source to read;</p> <p>Second, I'm not asking to solve this for me, but I just want a hint or simpler explanation that would make sense;</p> <p>Here is my function: </p> <pre><code> &lt;ul&gt; &lt;?php foreach ($categories as $category) { ?&gt; &lt;li&gt; &lt;a href="&lt;?php echo $category['href']; ?&gt;"&gt;&lt;p&gt;&lt;?php echo $category['name']; ?&gt;&lt;/p&gt;&lt;/a&gt; &lt;?php if ($category['children']) { ?&gt; &lt;div&gt; &lt;?php for ($i = 0; $i &lt; count($category['children']);) { ?&gt; &lt;?php $j = $i + ceil(count($category['children']) / $category['column']); ?&gt; &lt;?php for (; $i &lt; $j; $i++) { ?&gt; &lt;?php if (isset($category['children'][$i])) { ?&gt; &lt;ul&gt; &lt;li class="none"&gt;&lt;h1&gt;&lt;?php echo $category['children'][$i]['name']; ?&gt;&lt;/h1&gt;&lt;/li&gt; &lt;?php if ($category['children'][$i]['children_level2']) { ?&gt; &lt;?php for ($wi = 0; $wi &lt; count($category['children'][$i]['children_level2']); $wi++) { ?&gt; &lt;li&gt; &lt;a href="&lt;?php echo $category['children'][$i]['children_level2'][$wi]['href']; ?&gt;"&gt;&lt;?php echo $category['children'][$i]['children_level2'][$wi]['name']; ?&gt;&lt;/a&gt; &lt;/li&gt; &lt;?php } ?&gt; &lt;?php } ?&gt; &lt;/ul&gt; &lt;?php } ?&gt; &lt;?php } ?&gt; &lt;?php } ?&gt; &lt;/div&gt; &lt;?php } ?&gt; &lt;/li&gt; &lt;?php } ?&gt; &lt;/ul&gt; </code></pre> <p>I want this part, every 13 li elements to create a new .ul. ./ul. tags </p> <pre><code>&lt;?php if (isset($category['children'][$i])) { ?&gt; &lt;ul&gt; &lt;li class="none"&gt;&lt;h1&gt;&lt;?php echo $category['children'][$i]['name']; ?&gt;&lt;/h1&gt;&lt;/li&gt; &lt;?php if ($category['children'][$i]['children_level2']) { ?&gt; &lt;?php for ($wi = 0; $wi &lt; count($category['children'][$i]['children_level2']); $wi++) { ?&gt; &lt;li&gt; &lt;a href="&lt;?php echo $category['children'][$i]['children_level2'][$wi]['href']; ?&gt;"&gt;&lt;?php echo $category['children'][$i]['children_level2'][$wi]['name']; ?&gt;&lt;/a&gt; &lt;/li&gt; &lt;?php } ?&gt; &lt;?php } ?&gt; &lt;/ul&gt; &lt;ul&gt;&lt;li&gt;maximum of 13 elements&lt;/li&gt;&lt;/ul&gt; after 13 &lt;li&gt;&lt;/li&gt; elements create new &lt;ul&gt;&lt;/ul&gt; tags and put the 14 &lt;li&gt;&lt;/li&gt; element into the new &lt;ul&gt;&lt;/ul&gt; tag </code></pre> <p>I hope I explained what I want to do, for now I'll be waiting for your answers, </p> <p>p.s. this is more for my learning skills then actual work, so thanks in advice </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload