Re: Infinity and nested categories

From: Date: Mon, 13 Dec 2004 18:16:33 +0000
Subject: Re: Infinity and nested categories
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-204209@lists.php.net to get a copy of this message
Bruno B B Magalhães wrote: > Hi again everybody, > > well, I've asked it before, but I couldn't work on this at all. > > As some knows I have a system witch has a category system. The generic > part of the site is handled by a generic module called contents... > generic like products, services, company, etc. Where the content layout > and structure is quite the same. > > Well suppose that I have this: > > http://www.the_company.com/site/products/product_one/requirements/ > requirements.html > > Where: > site/ <---- the controller > products/ <----- alias module for content module > product_one/ <----- top category > requirements/ <----- nested category > <---------- as many nested categories as needed > requirements.html <----- article is called searching using it without > the .html, witch is used to know that it is an article and not a > category. ('WHERE article_path='requirements' AND category_id='022') > > My problem is that how can I handle those categories!!!!!!!!!!!!! and > build a three of it. Is it a true hierarchy, or is it a heterarchy? In other words, can "sub_category_57" appear in *TWO* different branches in the tree? If *NOT*, then you really don't need all the nested categories in your URL: As soon as you have the "bottom" category, you've already got all the others in your database. Of course, you could simply walk through $_SERVER['PATH_INFO'] and build your category list: <?php $parts = explode('/', $_SERVER['PATH_INFO']; $controller = $parts[0]; $module = $parts[1]; unset($parts[0]); unset($parts[1]); $categories = array(); while (list(, $cat) = each($parts)){ if (!strstr($cat, '.html')){ $categories[] = $cat; } } ?> -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#204209) next »