How to create divs inside php

0

I need to create divs that will be populated by objects of a class, I have in mind that I will need to use a foreach creating a div for each object, but I do not know how to call and position these divs in html, whether it is via ajax or another way.

    
asked by anonymous 17.06.2018 / 17:27

1 answer

1

You can do this, for example:

<div class="list-wrapper">
  <ul>
    <?php foreach ($items as $item): ?>
      <li><?php echo $item; ?></li>
    <?php endforeach; ?>
  </ul>
</div>

Reference:

17.06.2018 / 17:47