Advertisement
vividtea

Iterating through structure field

Sep 10th, 2024
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.29 KB | None | 0 0
  1. <?php if ($items = $page->items()->toStructure()): ?>
  2.   <ul>
  3.     <?php foreach ($items as $item): ?>
  4.       <li>
  5.         <strong>Order:</strong> <?= $item->order() ?><br>
  6.         <strong>Title:</strong> <?= $item->title() ?>
  7.       </li>
  8.     <?php endforeach; ?>
  9.   </ul>
  10. <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement