Skip to content

Instantly share code, notes, and snippets.

@propertyhive
Created September 13, 2021 09:46
Show Gist options
  • Save propertyhive/108c2b8ed156c4bfb9f588919b222a9e to your computer and use it in GitHub Desktop.
Save propertyhive/108c2b8ed156c4bfb9f588919b222a9e to your computer and use it in GitHub Desktop.
$floor_units = $property->floor_units;
if ( isset($floor_units->floor_unit) )
{
echo '<h4>Available Area</h4>'; // WILL BECOME DESCRIPTION TITLE
$total_size = 0;
// INSTEAD OF ECHO'ING SHOULD BE STORED AS DESCRIPTION TEXT/CONTENT
echo '<table>';
echo '<thead><tr><th>Name/Floor</th><th>Sq ft</th><th>Availability</th></tr></thead><tbody></tbody>';
foreach ( $floor_units->floor_unit as $floor_unit )
{
echo '<tr>
<td>' . (string)$floor_unit->floorunit . '</td>
<td>' . (string)$floor_unit->size . '</td>
<td>' . (string)$floor_unit->status . '</td>
</tr>';
$total_size += (string)$floor_unit->size;
}
echo '<tr>
<td>Total</td>
<td>' . $total_size . '</td>
</tr>';
echo '</table>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment