Categories & Records

7 posts by 5 authors in: Forums > CMS Builder
Last Post: February 7, 2011   (RSS)

By Kenny - November 19, 2010

This one gets me every time because each time I use it, everything is different.

I have a multi-record section called "categories" set up with title, description, and an image.

I have another multi-record section called "products" that has detailed product information. In the CMS, you can choose which category a product goes to by drop-down with list options populated from the MySQL table "categories" above.

My viewer pages are here:

All Categories:

http://www.drycreekminibarns.com/buildings/index.php

Buildings in that category:

http://www.drycreekminibarns.com/buildings/california.php

My problem is getting the buildings that belong in that category to be the only ones that show up on the page instead of all the buildings.

I tried to no avail using an if statement like this to no avail: <?php if ($record['category'] == 'echo $record['category']'): ?>

Kenny

Re: [sagentic] Categories & Records

By Jason - November 19, 2010

Hi Kenny,

I'm a little confused by your if statement as you're checking if the category field of a record = "echo $record['category']", which it never will.

The best thing to do is put your category as part of your where clause in your search query:

example:
'where' => "category='YOUR VALUE'",

you just replace YOUR VALUE with the value of the category you want to search on. This way you won't need an if statement, you'll only be returning the records you want.

Hope this helps. If you're still running into a problem, please attach the .php files you're working with so I can take a closer look.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

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

Re: [Jason] Categories & Records

By Kenny - November 19, 2010

Hi Jason,

The where statement would be good if I had a fixed number of categories, but the client will create new categories as time goes on.

Let me explain it this way: A user will start looking at all Building Categories here: http://www.drycreekminibarns.com/buildings/index.php

Let's say they choose Cabins & Cottages. This brings them to this page:
http://www.drycreekminibarns.com/buildings/california.php?Cabins-Cottages-13

Now the just category Cabins & Cottages shows up at the top of the page and what is supposed to show up underneath is the all of the buildings that have been assigned to the Cabins & Cottages category.

What shows up now is all of the buildings in every category.

How can I isolate just the buildings of a particular category given that the client will add new categories and building all the time?

Kenny

Re: [sagentic] Categories & Records

By Dave - November 21, 2010

Hi Kenny,

I've replied to this via email, let me know if you need anything else!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Categories & Records

By mohabsi - February 4, 2011 - edited: February 5, 2011

I have a multi-record section called "categories" has field (title)

I have another multi-record section called "articles" that has fields title ,details and category

In the CMS, you can choose which category a article goes to by drop-down with list options populated from the MySQL table "categories" above.

on My viewer pages i want to display articles title belong to the selected category as list on left side and display the details of the selected title in center area

the example is attached

how can i do that?
Attachments:

example_001.jpg 18K

Re: [mohabsi] Categories & Records

By Jason - February 7, 2011

Hi,

I posted a reply to your question in a different thread. Try this:
http://www.interactivetools.com/forum/gforum.cgi?post=86151#86151

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/