Created
April 24, 2012 10:47
-
-
Save lukearmstrong/2478724 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Controller | |
$customers = array( | |
'alan', | |
'luke' | |
); | |
// Imagine $orders may be undefined, null or false. | |
$orders = null; | |
?> | |
<? // View ?> | |
<h2>Customers</h2> | |
<? if (isset($customers) && is_array($customers) && !empty($customers)): ?> | |
<ul> | |
<? foreach ($customers as $customer): ?> | |
<li><?= $customer ?></li> | |
<? endforeach; ?> | |
</ul> | |
<? else: ?> | |
<p>No customers found</p> | |
<? endif; ?> | |
<h2>Orders</h2> | |
<? if (isset($orders) && is_array($orders) && !empty($orders)): ?> | |
<ul> | |
<? foreach ($orders as $order): ?> | |
<li><?= $order ?></li> | |
<? endforeach; ?> | |
</ul> | |
<? else: ?> | |
<p>No orders found</p> | |
<? endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment