N
N
Nikita Shchypylov2016-11-03 12:45:12
PHP
Nikita Shchypylov, 2016-11-03 12:45:12

How to determine half of the elements from a foreach loop?

Hello everyone
There is an iteration over the elements:

<ul>
                {foreach from=$item.confessions.items item=confession}
                  <li>{$confession.content}</li>
                {/foreach}
              </ul>

How can you tell when half of the elements are out li?
Half will need to close the tag uland open a new one with the other half li
Thank you

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Optimus, 2016-11-03
Pyan @marrk2

The for loop is easier to use in this case. You will have a counter variable there by which you will determine.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question