Combo Page List Viewer by Category

2 posts by 2 authors in: Forums > CMS Builder
Last Post: August 15, 2013   (RSS)

By mnoyes - August 14, 2013

I have a list of services, and each service can be placed into a category. I would like to have the list divided into the categories, with the category name at the head of each list. I have ben tried everything I can, and no luck.

here is the code I am working with....

-------------------------------

<?php
/* TEchnology Solutions */

// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/home/apitech1/public_html/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

// load detail record from 'solutions'
list($solutionsRecords, $solutionsMetaData) = getRecords(array(
'tableName' => 'solutions',
'where' => whereRecordNumberInUrl(1), // If no record # is specified then latest record is shown
'loadUploads' => true,
'allowSearch' => false,
));
$detailRecord = @$solutionsRecords[0]; // get first record
if (!$detailRecord) { dieWith404("Record not found!"); } // show error message if no record found

// load list records from 'solutions'
list($solutionsRecords, $solutionsMetaData) = getRecords(array(
'tableName' => 'solutions',
'loadUploads' => false,
'allowSearch' => false,
));

?>

--------------------------------

Here is the list code......

----------------------------------

<?php foreach ($solutionsRecords as $listRecord): ?>
<?php $isSelected = ($listRecord['num'] == $detailRecord['num']); ?>
<?php if ($isSelected) { print "<b>"; } ?>
<img src="A.png" width="8" height="9" alt="<?php echo htmlencode($listRecord['title']) ?>" /> <a href="<?php echo htmlencode($listRecord['_link']) ?>"><?php echo htmlencode($listRecord['title']) ?></a><br/><br/>
<?php if ($isSelected) { print "</b>"; } ?>
<?php endforeach ?>

-------------------------------

You can see the page here:

http://www.apitechnology.com/solutions.php

Would like the list menu divide by ['category']

any direction or help would be appreciated.