You can store structured data in fields with YAML. YAML is a simple structuring syntax, which is easy to understand and use.
For this example we are going to store multiple addresses in a single field:
Title: Addresses ---- Addresses: - Street: Rue de WTF 17 ZIP: 1112 City: Monaco Phone: 555-1234 Email: firstname.lastname@example.org - Street: 1212 Broadway ZIP: 4321 City: New York Phone: 666-4321 Email: email@example.com - Street: At the beach ZIP: 9999 City: The capitol of the Bahamas Phone: 777-9999 Email: firstname.lastname@example.org
Those addresses can be fetched and parsed very easily in your templates with the
<?php foreach(yaml($page->addresses()) as $address): ?> <div class="address"> <?php echo $address['street'] ?><br /> <?php echo $address['zip'] ?> <?php echo $address['city'] ?> </div> <div class="contact"> <?php echo $address['phone'] ?><br /> <?php echo $address['email'] ?> </div> </div> <?php endforeach ?>