Menu links

3 posts by 2 authors in: Forums > CMS Builder
Last Post: September 10, 2015   (RSS)

Hi Guys.

I've got a category section building the structure of my site, with 1st level records creating the pages, then 2nd level records creating sections within the parent page.

I'm building a site map with

<?php
// load records from 'pages'
list($pagesRecords, $selectedPages) = getCategories(array(
'tableName' => 'pages', //
'categoryFormat' => 'showall', // showall, onelevel, twolevel, breadcrumb
'defaultCategory' => '', // Enter 'first', a category number, or leave blank '' for none

// advanced options (you can safely ignore these)
'rootCategoryNum' => '', // Only categories _below_ this one will be shown (defaults to blank or 0 for all)
'ulAttributes' => '', // add html attributes to <ul> tags, eg: 'class="menuUL"' would output <ul class="menuUL">
'selectedCategoryNum' => '', // this record number is returned as the "selected category", defaults to getLastNumberInUrl()
'ulAttributesCallback' => '', // ADVANCED: custom function to return ul attributes, eg: 'myUlAttr' and function myUlAttr($category) { return "id='ul_uniqueId_{$category['num']}'"; }
'liAttributesCallback' => '', // ADVANCED: custom function to return li attributes, eg: 'myLiAttr' and function myLiAttr($category) { return "id='li_uniqueId_{$category['num']}'"; }
'loadCreatedBy' => false, // loads createdBy.* fields for user who created category record (false is faster)
'loadUploads' => true, // loads upload fields, eg: $category['photos'] gets defined with array of uploads (false is faster)
'ignoreHidden' => false, // false = hide records with 'hidden' flag set, true = ignore status of hidden flag when loading records
'debugSql' => false, // display the MySQL query being used to load records (for debugging)
));

?>
<ul class="footerList">
<?php foreach ($pagesRecords as $categoryRecord): ?>

<?php echo $categoryRecord['_listItemStart'] ?>

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

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

<?php endforeach; ?>
</ul>

This displays fine, the "parent" link (blue) goes to the page such as /page.php?About-1.  However the children (red) go to /page.php?About-The-NTA-7 and I need them to go to /page.php?About-1#section1 where the id is created by id="section<?php echo htmlencode($record['num']) ?>">

Is that possible?

Cheers,

Tim (toledoh.com.au)

Perfect - thanks Greg!

Cheers,

Tim (toledoh.com.au)