Need multi-level subcategories to appear on another page

4 posts by 2 authors in: Forums > CMS Builder
Last Post: January 20, 2011   (RSS)

By NigelGordijk - January 19, 2011

Hi, All.

I'm trying to set up a site section that is divided into categories and subcategories. Here's the index page - http://www.tomlinsonelitehockey.com/members/pw_videosList.php. It's not apparent from the live page, but "Hockey Canada Skills Review" is the top level, "Balance and Agility" is a subcategory of that, and all of the titles preceded by numbers are part of the subcategory "Balance and Agility".

I'd like the index page to show only the top level category - in this case, "Hockey Canada Skills Review" - which people would click on to see the list of subcategories. They would then click on their selected subcategory and go to another page that lists all of the items within it. So there would be an index of top level categories that links to an index of subcategories, which links to individual detail pages; e.g http://www.tomlinsonelitehockey.com/members/pw_videosDetail.php?Hockey-Canada-Skills-Review-Balance-and-Agility-1.00-Intro-Balance-and-Agility-4.

Here's the relevant code I'm using on the index page. In the head of the document:

<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php


// load viewer library
$libraryPath = 'cmsAdmin/lib/viewer_functions.php';
$dirsToCheck = array('/home/tomhoc/public_html/','','../','../../','../../../');
foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

// load records
list($pw_videosRecords, $pw_videosMetaData) = getRecords(array(
'tableName' => 'pw_videos',
'perPage' => '20',
'loadUploads' => '0',
));

?>

And where the content is displayed:

<?php foreach ($pw_videosRecords as $record): ?>
<h4><a href="<?php echo $record['_link'] ?>"><?php echo $record['name'] ?></a> </h4>
<hr/>
<p>
<?php endforeach ?>

<?php if ($pw_videosMetaData['invalidPageNum']): ?>
<?php elseif (!$pw_videosRecords): ?>
<?php endif ?>
<!-- /STEP2: Display Records -->


<!-- STEP3: Display Page Links (Paste anywhere below "Load Record List") -->
<?php if ($pw_videosMetaData['prevPage']): ?>
<a href="<?php echo $pw_videosMetaData['prevPageLink'] ?>">&laquo; Previous</a>
<?php else: ?>
&laquo; Previous
<?php endif ?>

- Page <?php echo $pw_videosMetaData['page'] ?> of <?php echo $pw_videosMetaData['totalPages'] ?> -

<?php if ($pw_videosMetaData['nextPage']): ?>
<a href="<?php echo $pw_videosMetaData['nextPageLink'] ?>">Next &raquo;</a>
<?php else: ?>
Next &raquo;
<?php endif ?>
</p>
<!-- /STEP3: Display Page Links -->

Any help, please?
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net

Re: [NigelGordijk] Need multi-level subcategories to appear on another page

By Chris - January 19, 2011

Hi Nigel,

I can't access the URLs you posted: your web server is asking me to login with a username and password.

Does [url http://www.interactivetools.com/forum/gforum.cgi?post=77386#77386]this post[/url] sound like what you want? I think you're going to want to use a Category Menu for this . Have you tried the Sub-categories Tutorial?
All the best,
Chris

Re: [chris] Need multi-level subcategories to appear on another page

By NigelGordijk - January 19, 2011

Sorry; try these:

http://www.tomlinsonelitehockey.com/pw_videosList.php

http://www.tomlinsonelitehockey.com/pw_videosDetail.php?Hockey-Canada-Skills-Review-Balance-and-Agility-1.00-Intro-Balance-and-Agility-4
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net