Category List needs to link to different Detail pages
2 posts by 2 authors in: Forums > CMS Builder
Last Post: February 23, 2010 (RSS)
By JeffC - February 20, 2010 - edited: February 20, 2010
Hi
My question has two parts...
1. I have created a navigation menu with sub categories, using 'Add New Editor' 'Category Menu'
The menu list is working fine.
However, I need to be able to assign different detail pages to the Top Level categories to those used on the sub category pages.
For example
Item 1 - detail1.php
Item 1a - detail2.php
Item 1b - detail2.php
Item 2 - detail1.php
Item 2a - detail2.php
Item 2b - detail2.php
The top level categories will be a general introduction to the section of the site. The subcategories will be more detailed pages.
Here is my current code on my list page. The problem here is that Top Level categories and sub categories all go to the same detail page.
<?php
require_once "cmsAdmin/lib/viewer_functions.php";
list($categoryRecords, $selectedCategory) = getCategories(array(
'tableName' => 'navigation',
'selectedCategoryNum' => '', // defaults to getNumberFromEndOfUrl()
'categoryFormat' => 'showall', // showall, onelevel, twolevel
));
?>
<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>
<a href="mailto:?subject=<?php echo thisPageUrl() ?>">Email this Page</a>
2. The two different detail pages need to have different fields. In the CMS I would like the user to be directed to different pages depending on whether they choose to create a top level item or a sub category.
My question has two parts...
1. I have created a navigation menu with sub categories, using 'Add New Editor' 'Category Menu'
The menu list is working fine.
However, I need to be able to assign different detail pages to the Top Level categories to those used on the sub category pages.
For example
Item 1 - detail1.php
Item 1a - detail2.php
Item 1b - detail2.php
Item 2 - detail1.php
Item 2a - detail2.php
Item 2b - detail2.php
The top level categories will be a general introduction to the section of the site. The subcategories will be more detailed pages.
Here is my current code on my list page. The problem here is that Top Level categories and sub categories all go to the same detail page.
<?php
require_once "cmsAdmin/lib/viewer_functions.php";
list($categoryRecords, $selectedCategory) = getCategories(array(
'tableName' => 'navigation',
'selectedCategoryNum' => '', // defaults to getNumberFromEndOfUrl()
'categoryFormat' => 'showall', // showall, onelevel, twolevel
));
?>
<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>
<a href="mailto:?subject=<?php echo thisPageUrl() ?>">Email this Page</a>
2. The two different detail pages need to have different fields. In the CMS I would like the user to be directed to different pages depending on whether they choose to create a top level item or a sub category.
Jeff
Re: [Jeffncou] Category List needs to link to different Detail pages
By Chris - February 23, 2010
Hi Jeffncou,
You'll want to set this up with two separate sections. You can create two Multi Record sections and give the second section a List field which refers to the first section. To do this, in the field editor, set List Options to "Get options from database (advanced)", choose the Section Tablename of the first section, "Use this field for option values": "num", and choose your title or name field for "Use this field for option labels".
You'll need to rebuild your menu list. If you need help with that, please generate List pages for both sections and post them here, then I'll show you how to mesh them together so you can have something that looks the same as your Category Menu menu list.
I hope this helps. Please let me know if you have any questions.
You'll want to set this up with two separate sections. You can create two Multi Record sections and give the second section a List field which refers to the first section. To do this, in the field editor, set List Options to "Get options from database (advanced)", choose the Section Tablename of the first section, "Use this field for option values": "num", and choose your title or name field for "Use this field for option labels".
You'll need to rebuild your menu list. If you need help with that, please generate List pages for both sections and post them here, then I'll show you how to mesh them together so you can have something that looks the same as your Category Menu menu list.
I hope this helps. Please let me know if you have any questions.
All the best,
Chris
Chris