Q
Q
Qixing2015-01-27 09:19:24
PHP
Qixing, 2015-01-27 09:19:24

How to substitute a variable in divisibleby?

Good afternoon. Crashes when executing code

{% set num = (category|length) // 3 %}

<ul class="uList1 ">

    {% for item in category %}
    {% if loop.index is divisibleby(num) %}
        </ul>
        <ul class="uList1 ">
    {% endif %}
    <li><a href="#">{{ item.name }}</a></li>
    {% endfor %}
</ul>

An exception has been thrown during the rendering of a template ("Warning: Division by zero")
Doesn't treat it as a number. number_format also tried. How to be?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2015-01-27
@Nc_Soft

probably num=0

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question