question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jollyjumper
Forum Contributor
Posts: 107
Joined: Sat Jan 25, 2003 11:03 am

question

Post by jollyjumper »

Hi Everyone,

I'm currently working on a project, but I can't solve a problem I'm facing.

What I would like to create is this:
I've got records that are based on a county and a category.
I want to start with both a list of categories, as well as a list of counties as an entrypoint.

The problem isn't in creating the lists or something, but it's the structure I want to do it in. I would like to use virtual subfolders.

Like when you start with selecting a category, you get on the page:
/categoryname/county_overview.php

and when you've selected the county, then you'll get into:
/categoryname/countyname/showlist.php

Also this isn't a problem. The problem starts when I want to start from the county list as well, as you would get this:

/countyname/category_overview.php
/countyname/categoryname/showlist.php

I don't know how I would be able to see which entrypoint the user has chosen, was it a category or a county(e.g. is the first subfolder name the name of a category or is it one of a county).

If you've got an idea about a solution, please post it, you would really help me a lot.

Greetz Jolly.
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Depends on your exact setup, but presuming you can get/know the entry point, lets say $entrypoint, and the countries are in an array, then you could use in_array to see if $entrypoint is there, if not you can presume it's a category ?
jollyjumper
Forum Contributor
Posts: 107
Joined: Sat Jan 25, 2003 11:03 am

Post by jollyjumper »

Hi Mark,

Thank you for your reply.

The categories and counties will be in a database.

I've thought about the sollution you spoke about before I posted my question, but the major downside about this is that I would have to select either all counties or categories to check this, even if I don't need all the other categories or counties.

I don't think it's a bad sollution, maybe it's the only one, but I'm hoping for a better one.

Greetz Jolly.
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Yeah, if they are in a db then an array isn't the best way to go. Doesn't the database distinguish between countries and categories, so a simple SELECT can't find out which type of entry point was used?
jollyjumper
Forum Contributor
Posts: 107
Joined: Sat Jan 25, 2003 11:03 am

Post by jollyjumper »

Hi Mark,

I don't exactly get what you mean by distinguish?

Greetz Jolly.
Post Reply