Organizing Lists

13 posts by 2 authors in: Forums > CMS Builder
Last Post: February 8, 2010   (RSS)

Re: [jtedescojam] Organizing Lists

By Chris - February 8, 2010

Hi jtedescojam,

This page is a lot more complicated to rewrite to have automatic column headings. In fact, it may be simpler to just leave your page how it is. :)

This goes a little above what we tend to offer for support, but I thought it'd be nice to give you an idea of one possible approach:

<?php
list($policiesRecords, $policiesMetaData) = getRecords(array(
'tableName' => 'policies',
'allowSearch' => '0',
));

$policySectionName = array(
"0000" => "Bylaws",
"1000" => "Administration",
"2000" => "Program",
"3000" => "Teaching Staff Members",
"4000" => "Support Staff Members",
"5000" => "Pupils",
"6000" => "Finances",
"7000" => "Property",
"8000" => "Operations",
"9000" => "Community"
);
?>

<?php $currentPolicySection = "none"; ?>
<?php $sectionRecordCount = 999; ?>
<?php foreach ($policiesRecords as $record): ?>
<?php foreach ($record['document'] as $upload): ?>
<?php $thisPolicySection = floor($record['policy_number'] / 1000) . "000" ?>
<?php if ($thisPolicySection != $currentPolicySection): ?>
<?php if ($sectionRecordCount == 0): ?>
<p>Please be patient while we re-structure this section.</p>
<?php endif ?>
<?php $currentPolicySection = $thisPolicySection ?>
<?php $sectionRecordCount = 0 ?>
<p class="policyheader"><?php echo $currentPolicySection ?> - <?php echo @$policySectionName[$currentPolicySection] ?></p>
<?php endif ?>
<p>
<a href="<?php echo $upload['urlPath'] ?>"><?php echo $record['policy_number'] ?> - <?php echo $record['policy_title'] ?></a>
</p>
<?php endforeach ?>
<?php endforeach ?>


I hope this helps!
All the best,
Chris

By jtedescojam - February 8, 2010

Thanks Chris.. I'm actually glad you said it was simpler to leave it the way it is! ;) I just wanted to make sure there wasn't a super-easy way to do this. Thank you for the extra effort.
John Tedesco

Creative Director



JAM Graphics