Welcome Guest, Not a member yet? Register   Sign In
Category and filtering help
#1

[eluser]Sceneshift[/eluser]
I would be really grateful if someone could help me out here.

I have a system where the user will navigate through categories, which whittles down the results as they go. Here is an example of how it would work:

Country -> Region -> Area

Clearly this is possible with CI, and at the moment my URL looks like so:

http://www.myname.com/search/country_region_area/result
(where result is the 'place' they found from filtering down)

The problem is, the category (country_region_area) is just a string, and it would be stupid to try and make breadcrumbs etc out of this data. As I understand it, an alternative would be to setup url routing and have something like http://www.myname.com/search/country/reg...ea/result/ but I can't help but feel like there is an easier method?

Can someone please shed some light on to how I can keep track of the categories I navigate in a efficient manner, perhaps its worth setting up a category system in the database, but then that would require horrible recursive functions to create the breadcrumbs.

Thanks!
#2

[eluser]Pascal Kriete[/eluser]
How are the categories structured right now? How many tables? How deep will they go?

If the parent-child relationships are clear (only one parent) and you have a lot of levels, a tree based structure would be best. Also, if you're using the url to look up the category, why not use it to display the breadcrumb?
#3

[eluser]Sceneshift[/eluser]
At the moment I haven't got any category structure in place. I'm trying to figure it out on paper first.

It will literally be case of "Country -> Region -> Area", so that means the category structure would go 3 deep I suppose?

I was thinking of have a "category" table which has a name and a uri_name, so then I can convert "country_region_area" to something readable using a db query. This would mean having a hell of a lot of categories in my database though.

The more I think about it, the more confused I get!




Theme © iAndrew 2016 - Forum software by © MyBB