directory browsing
| From: | Uros Gruber | Date: | Wed, 01 May 2002 23:02:07 +0000 |
| Subject: | directory browsing | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-95624@lists.php.net to get a copy of this message | ||
Hi!
I wan't to make directory browsing like yahoo or google over
categories.
For example look on
http://www.google.com/dirhp
I have made myself 2 diferent ways. One is quicker but more
complex and oher is slower but easy to read and understand.
In my table i have this colums
id_cat, name, id_parent, level
What i want to know is if anybody have done this and how. I
want to know if i'm doing right way or is there another way.
1.) In my first way i fisrt select data from db with
condition where id_parent='some_category'.
Then i recursively run thru array of id_cat's which i have
from previsious query. And get data for sub categories.
This method is simple to program but it's slow on many
categories.
2.) second way i use colum level to help get second query.
First query is the same as on 1st example. In second query i
select all categories which is one level lower than this i'm
id. But then i have to program to delete all neceseary data
from this array.
This method was quicker but more complex.
I hope this is understandable. I wan't to know how to code
this. Is there maybe another way (better way) to solve this.
Is maybe somewhere class for this.
--
tia,
Uros