Nikolas Posted June 26, 2020 Report Share Posted June 26, 2020 Привет!Есть верстка категории, где в одной строке row выводиться только 2 товара. В следующей - еще два и т.д. Подскажите, как это правильно вывести? <div class="row"> <div> товар </div> <div> товар </div> </div> <div class="row"> <div> товар </div> <div> товар </div> </div> Спасибо! Quote Link to post Share on other sites
shooroop Posted June 26, 2020 Report Share Posted June 26, 2020 используете поиск, на эту тему было 4 темы если не больше. Quote Link to post Share on other sites
Nikolas Posted June 26, 2020 Author Report Share Posted June 26, 2020 К сожалению, через поиск не нашел.... Quote Link to post Share on other sites
Noxter Posted June 26, 2020 Report Share Posted June 26, 2020 (edited) <table> {foreach array_chunk($products, 3) as $chunk} <tr> {foreach $chunk as $product} <td>{$product->name}</td> {/foreach} </tr> {/foreach} </table> Edited June 26, 2020 by Noxter Quote Link to post Share on other sites
Nikolas Posted June 26, 2020 Author Report Share Posted June 26, 2020 не работает( Quote Link to post Share on other sites
shooroop Posted June 26, 2020 Report Share Posted June 26, 2020 вы не нашли а я почемуто нашел первым запросом http://forum.simplacms.ru/topic/8740-%D0%BA%D0%B0%D0%B6%D0%B4%D1%8B%D0%B5-3-%D1%82%D0%BE%D0%B2%D0%B0%D1%80%D0%B0-%D0%B2-div-e/.... Quote Link to post Share on other sites
Nikolas Posted June 26, 2020 Author Report Share Posted June 26, 2020 Спасибо! Quote Link to post Share on other sites
Noxter Posted June 26, 2020 Report Share Posted June 26, 2020 не работает(Дело в руках скорее всего Quote Link to post Share on other sites
Nikolas Posted June 30, 2020 Author Report Share Posted June 30, 2020 Сделал вот так.http://forum.simplacms.ru/topic/7713-%D0%B2%D0%B5%D1%80%D1%81%D1%82%D0%BA%D0%B0-%D0%B2%D1%8B%D0%B2%D0%BE%D0%B4-%D1%82%D0%BE%D0%B2%D0%B0%D1%80%D0%BE%D0%B2-%D0%BF%D0%BE-4%D1%88%D1%82-%D0%B2-%D0%BE%D0%B4%D0%BD%D0%BE%D0%BC-%D0%B4%D0%B8%D0%B2%D0%B5/ Quote Link to post Share on other sites
Nikolas Posted June 30, 2020 Author Report Share Posted June 30, 2020 (edited) Подскажите, как в этой конструкции каждому второму товару проставить другой класс? <div class="row"> <div class="1"> товар </div> <div class="2"> товар </div></div><div class="row"> <div class="1"> товар </div> <div class="2"> товар </div></div> Edited June 30, 2020 by Nikolas Quote Link to post Share on other sites
phukortsin Posted June 30, 2020 Report Share Posted June 30, 2020 Примерно так:{if $product@iteration%2 == 0} class="2" {/if} Quote Link to post Share on other sites
shooroop Posted June 30, 2020 Report Share Posted June 30, 2020 Подскажите, как в этой конструкции каждому второму товару проставить другой класс? можно просто в css прописать .row div. и .row div + div Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.