Creating a side menu with categories of products

12 posts by 2 authors in: Forums > CMS Builder
Last Post: August 25, 2010   (RSS)

By fsardoni - August 25, 2010

Ok I think I got it working without the previous error. Thank you.
The code now looks like this:
<?php


// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/home/content/g/o/f/gofgof/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."); }

list($categoriesRecords, $selectedCategory) = getCategories(array(
'tableName' => 'categories',
));

list($productsRecords, $productsMetaData) = getRecords(array(
'tableName' => 'products',
));

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
</head>
<body>
<ul>
<li><a href="productsList.php">(All Products)</a></li>
<?php foreach ($categoriesRecords as $categoryRecord): ?>
<?php echo $categoryRecord['_listItemStart'] ?>

<?php if ($categoryRecord['_isSelected']): ?><b><?php endif ?>
<a href="/productsList.php?categories=<?php echo $categoryRecord['num'] ?>"><?php echo $categoryRecord['name'] ?></a></a>
<?php if ($categoryRecord['_isSelected']): ?></b><?php endif ?>

<?php echo $categoryRecord['_listItemEnd'] ?>
<?php endforeach ?>
</ul>
</body>
</html>