Coding help with easy multi level nested list flyout menu

6 posts by 3 authors in: Forums > CMS Builder
Last Post: October 18, 2009   (RSS)

Re: [dbown] Coding help with easy multi level nested list flyout menu

By Damon - October 10, 2009

Hi,

The screenshot wasn't attached and it would be helpful to see how you have the categories setup in CMS Builder, can you attach it?
Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [dbown] Coding help with easy multi level nested list flyout menu

By Chris - October 11, 2009

Hi Dave,

You can use the following code to create a nested <UL> structure for your categories:

<ul>
<?php foreach ($categoryRecords as $categoryRecord): ?>
<?php echo $categoryRecord['_listItemStart'] ?>

<?php if ($categoryRecord['_isSelected']): ?>
<b><a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a></b>
<?php else: ?>
<a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a>
<?php endif; ?>

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


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

Re: [chris] Coding help with easy multi level nested list flyout menu

By dbown - October 11, 2009

Hi Chris,

Thanks for hte help.

I've tried adding the attachment again. If it doesn't work it can also be seen at
http://www.canadasprayerguide.com/WebsiteCMS/menu-structure.gif.

I added your code but received an error.
It can be seen at Link: http://www.canadasprayerguide.com/WebsiteCMS/menutest2.php



The header code is as follows:

<?php

require_once "/home/canadasp/public_html/cmsAdmin/lib/viewer_functions.php";

list($testRecords, $testMetaData) = getRecords(array(
'tableName' => 'test',
));

?>



I changed the first line of your code to so match my category name. It now reads as follows:

<?php foreach ($testRecords as $categoryRecord): ?>
<?php echo $categoryRecord['_listItemStart'] ?>

<?php if ($categoryRecord['_isSelected']): ?>
<b><a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a></b>
<?php else: ?>
<a href="<?php echo $categoryRecord['_link'] ?>"><?php echo $categoryRecord['name'] ?></a>
<?php endif; ?>

<?php echo $categoryRecord['_listItemEnd'] ?>
<?php endforeach; ?>


This version also produces and error that can be seen at Link: http://www.canadasprayerguide.com/WebsiteCMS/menutest3.php


Any further help that you can provide would be most appreciated.

Best Regards,
Dve
Attachments:

menu-structure.gif 25K

Re: [dbown] Coding help with easy multi level nested list flyout menu

By Chris - October 13, 2009

Hi Dave,

Sorry, I should have mentioned that instead of getRecords(), you'll need to use getCategories() to make _listItemStart and _listItemEnd available.

list($testRecords, $selectedTestRecord) = getCategories(array(
'tableName' => 'test',
));


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

Re: [chris] Coding help with easy multi level nested list flyout menu

By dbown - October 18, 2009

Thank you Chris, that did the trick.

Cheers,
Dave