Multiple Category Menus

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

Re: [pcolvin] Multiple Category Menus

By Chris - November 11, 2010

Hi pcolvin,

This should certainly be possible. Each of your Category Menus will be a branch of your navigation tree. You'll want to hard-code the "root" of your tree. Here's an example:

<ul>
<li>
Home
</li>
<li>
Sales
<ul>
<?php foreach ($salesCategoryRecords as $categoryRecord): ?>
...
<?php endforeach ?>
</ul>
</li>
<li>
Support
<ul>
<?php foreach ($supportCategoryRecords as $categoryRecord): ?>
...
<?php endforeach ?>
</ul>
</li>
</ul>


I hope this helps! Please let me know if you have any questions.
All the best,
Chris

Re: [chris] Multiple Category Menus

Chris,

This makes sense and I'll give it a try.

What would you suggest for the code to load the records for each section at the top of the page? Obviously I'll need to reference each table for the different sections in tableName. What would be the best way to do that?

<?php

require_once "cmsAdmin/lib/viewer_functions.php";

list($categoryRecords, $selectedCategory) = getCategories(array(
'tableName' => 'category',
'selectedCategoryNum' => '', // defaults to getNumberFromEndOfUrl()
'categoryFormat' => 'showall', // showall, onelevel, twolevel
));

?>


Many thanks...

Re: [pcolvin] Multiple Category Menus

By Chris - November 12, 2010

Hi pcolvin,

I'd simply copy-and-paste the getCategories code, changing the names of your variables and tables:

list($salesCategoryRecords, $selectedSalesCategory) = getCategories(array(
'tableName' => 'sales_category',
));
list($supportCategoryRecords, $selectedSupportCategory) = getCategories(array(
'tableName' => 'support_category',
));


If you need to use "selected categories", things become a little more complicated because you can't simply use getNumberFromEndOfUrl (since the number might refer to a sales or a support category!)

Please let me know if you have any questions.
All the best,
Chris