V
V
viktorross2019-08-30 07:03:15
Smarty
viktorross, 2019-08-30 07:03:15

How to output content of smarty loop only 1 time?

hello, please tell me how to display the contents of the loop only 1 time after 5 elements?

{if $smarty.foreach.listings.index %5 ==0}
...
{/if}

I need it to be displayed not every 5 elements, but after 5 elements once, and
how can I do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2019-09-01
@thewind

Offhand, there are two ways - either add a flag variable that we have already been in this condition and do not go here anymore (at first, the variable is equal to false, when we entered the condition, it was set to true, and && var == false was added to the condition. The second way is when entered the condition and executed the code there, then at the end do {break}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question