Ambiguous behaviour of navigation list in viewer

4 posts by 2 authors in: Forums > CMS Builder
Last Post: April 28, 2017   (RSS)

By terryally - April 21, 2017

Hi,

I am running a horizontal navigation menu at the top of my page and then another in the footer. The top navigation menu is using "showall" as the categoryFormat while the footer menu is using "onelevel". I am using the same table (navigation_menu) for both menus.

In the viewer URL of one section, the footer menu is behaving schizophrenically. For records 1, 4, 5, 6 it does a "showall" in the footer but for the other records it does a "onelevel" display. The code I am using for the footer navigation menu is below. Can you tell me why it sometimes displays all records and sometimes only one level?

<?php
  // load records from 'navigation_menu'
  list($navigation_menuRecords, $selectedNavigation_menu) = getCategories(array(
    'tableName'            => 'navigation_menu',
    'categoryFormat'       => 'onelevel', 
    'defaultCategory'      => '',
    
    // advanced options (you can safely ignore these)
    'rootCategoryNum'      => '',     
    'ulAttributes'         => '',     
    'selectedCategoryNum'  => '',     
    'ulAttributesCallback' => '',     
    'liAttributesCallback' => '',     
    'loadCreatedBy'        => false,  
    'loadUploads'          => true,   
    'ignoreHidden'         => false,  
    'debugSql'             => false,  
  ));
?>

<?php foreach ($navigation_menuRecords as $categoryRecord): ?>
    <?php if ($categoryRecord['target']) {
        $target = 'target="';
        $target .= $categoryRecord['target'];
        $target .= '"';
    } else {$target="";}
    ?>
  <?php echo $categoryRecord['_listItemStart'] ?>
    <a href="<?php echo $categoryRecord['page_url'] ?>" <?php echo $target;?>><?php echo $categoryRecord['name'] ?></a>
  <?php echo $categoryRecord['_listItemEnd'] ?>
<?php endforeach; ?>

Thanks

Terry

By terryally - April 28, 2017

Hi Deborah,

Thanks for taking the time to respond.

If you were to remove the PHP code, the HTML code that remains is correct:

<a href=""></a>

Having not found a solution in the last week since posting this, I've altered the design on the page template and removed this horizontal menu.

Regards

Terry

By Deborah - April 28, 2017

Sorry, Terry. I should have studied that for a bit longer. Wish I had a solution, but maybe someone will post, yet.

~ Deborah