Re: [PHP] Infinity and nested categories
Thanks Richard! Helped a lot! Regards, Bruno B B Magalhaes On Dec 13, 2004, at 4:16 PM, Richard Lynch wrote: 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Infinity and nested categories
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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Infinity and nested categories
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. I am using PHP5 and MySQL 4.1 Regards, Bruno B B Magalhaes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php