Filter by Category

3 posts by 2 authors in: Forums > CMS Builder
Last Post: October 24, 2009   (RSS)

By Roj - October 23, 2009

Hi,

I have created a 'list' page where the number of records is making the page a bit long. I am trying to create an index page where I can select a number of records by category. So I have created a category 'section' and created an index page from this that lists the categories. I have also added a category field (field type: list) in my data.

The problem is how do I make this work. When I click on a category on my index page I want it to filter the records and only show the records that are in the category selected.

Hope this makes sense,

Roger
Roj

Re: [Roj] Filter by Category

By Chris - October 23, 2009

Hi Roger,

Assuming that your field is called "category", you can search your records like this:

exampleList.php?category=123

On your category list page, you can generate links with the correct "num" like this:

<a href="exampleList.php?category=<?php echo $record['num'] ?>">View records in this category</a>

I hope this helps! Please let me know if you have any questions.
All the best,
Chris