Sub-categories Tutorial

134 posts by 17 authors in: Forums > CMS Builder
Last Post: August 7, 2012   (RSS)

By mohabsi - January 15, 2011

FANTASTIC ! IT WORKS! thank you a lot Jason ![shocked]

Re: [chris] Sub-categories Tutorial

By NigelGordijk - January 19, 2011 - edited: January 19, 2011

Hi, Chris.

I tried adding the line of code - 'categoryFormat' => 'onelevel', - but I get an error message on the page: http://www.tomlinsonelitehockey.com/pw_videosList2.php. This is what it looks like without that code: http://www.tomlinsonelitehockey.com/pw_videosList.php.

In this example, I only want Hockey Canada Skills Review to appear on the first page, followed by Balance and Agility on the next page, and finally all of the numbered items/links on a page that has the heading Balance and Agility.

Am I missing something, please?
Nigel Gordijk

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

Re: [NigelGordijk] Sub-categories Tutorial

By Jason - January 19, 2011

Hi Nigel,

I tired to go to the url you gave, but it's asking for a username/password to be able to access this.

What version of CMS Builder are you using? If you're using an old version, that code may not work.

If you require more help with this, please fill out a [url http://www.interactivetools.com/support]2nd level support request[/url] so we can see what's actually happening. Be sure to include the bravenet username/password in this request (don't post this to the forum).

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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

By NigelGordijk - January 20, 2011 - edited: January 20, 2011

So sorry - I forgot that I'd left the Bravenet password code on these pages. I've deleted them now, but I'll send a support request anyway.

By the way, this is the latest version of CMSB. It was upgraded earlier this week.
Nigel Gordijk

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

Re: [NigelGordijk] Sub-categories Tutorial

By Chris - January 20, 2011

Hi Nigel,

Is your section a Category Menu? Did you follow the steps outlined in the first post?
All the best,
Chris

Re: [chris] Sub-categories Tutorial

Hi, Chris.

Jason is looking into this for me via a request ticket.

Cheers,
Nigel Gordijk

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

Re: [mohabsi] Sub-categories Tutorial

By Jason - February 7, 2011

Hi,

What you need to do is when someone clicks on a category, you need to pass the category to the second page. You can then select all the categories that belong to this category.

For example, let's assume that the field in your articles section is called category and that you're using "num" as the value for this field. When they select a category on page one, it could look like this:

http://www.yoursite.com/page2.php?category=3

On page2.php you use getRecords() to select your articles. Since the name is the URL (category) matches the name of a field in articles, CMS Builder will automatically create your WHERE clause for you and only select articles that are in category 3.

Give this a try and let us know if you run into any trouble.

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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

By mohabsi - February 7, 2011

PERFECT!!!!!!

thanks sooo much Jason

I add this code


'allowSearch' => '0',
'where' => 'category = ' . @$_REQUEST['category'],

Re: [Chris] Sub-categories Tutorial

Hi, Chris.

I've set up a demo for a client based on your tutorial, and it all seems to be working ok: http://www.commonsensedesign.net/demoTownship.php. There are a few things I'd like to do to amend this, though. (Please note that About Finance Department and Staff Directory are hand coded into the page and aren't controlled via CMSB).

1. At the moment the page lists all of the subcategory pages at the bottom of the page by default (Pre-authorized Payments, etc). Is there a way to avoid these appearing? I only want to show options for the category that the user has selected.

2. In my demo when you click on, say, Tax you're shown the subcategories Tax Rates, Tax and Water Certificates, etc. You have to click on Tax Rates to see the page within that subcategory; in this case the page is called Tax Rates Information. Is there a way to go straight from the Tax Rates link to the page in that subcategory? http://www.commonsensedesign.net/demoTownshipDetails.php?Tax-Rates-Information-2. In each of the subcategories there is only one page so there's no need to present an option of one. That creates an extra click for no reason. (See demo.jpg).

3. I have sub-navigation on the left hand side and I would like this to only show the top level categories; in this example, Pre-authorized Payments, Tax, and Water. I don't want the subcategories to show up here, which is what happens when you click on a top level category, either on the left or in the main content. This applies to the details page, too.

I've attached both the index and details pages.

Many thanks,
Nigel Gordijk

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