On our online shop (PHP/MySQL), for our category structure we are using a transitive closure table (ancestor, descendant, length) as described by Bill Karwin.
I am finding it very flexible and useful, but can not work out how to print the complete category tree without recursion. Is this possible?
For example, I want an output similar to:
- Audio
- Portable
- MP3
- Portable
- Computing
- Optical Drives
- DVD-RW
- Input Devices
- Wireless
- Keyboards
- Wireless
- Optical Drives
- Household Appliances
- Televisions
- LCD
- Widescreen
- CRT
- LCD
Optionally limiting by the total category depth.
Is this a limitation of this model, or is there a way around it? At present I have been using recursion and caching the result.