ok this may help a bit (I think)
you want something like this:
A
--A1
--A2
--A3
B
C
--C1
--C2
--C3
----C3A
----C3B
----C3C
D
E
F
G
First you got to have your tables like this.
ID, title, PID (parrent id)
ok use
function rec_tree($pid)
{
//some connect stuff here
$sql = "SELECT * FROM mymenu WHERE PID = '$pid' "
// some database get here
// and print the output
// then use the id and call your self
rec_tree($id)
}
first you start with the $pid = 0
and you get
A
B
C
D
E
F
G
and then for each time you write out a line (data)
you call the same function that you made with pid = the lines id
make sure you use some DEAD LOCK detection like IF or a counter or something
so you don't get an infi. loop :)
"-{ Rene Brehmer }-" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> At 20:03 30-03-2004, you wrote:
> >Well,
> >
> >I did a similar system for my CMS sollution. If I understand you
> >correct you want to sort the main branch, keeping the subs.
>
> Not really ... I want to be able to expand the current sub to the current
> sub's level, list the subfolders contained within the current sub, and
have
> it not expand any other subs of the root... and then still list the entire
> root folder structure before and after ... my main problem is really
> finding an easy way to locate the root folder to start branching, with
> using as few queries as possible ...
>
> The sorting is really completely irrelevant in this connection, it's more
a
> matter of locating the right branches to expand...
>
> I've not looked at it since I did the first test ... been busy with other
> things ... but was considering doing a series of reverse recursive SQL
> pulls, where I start with the requested folder's ID, put that in an array,
> then find the parent of that folder, put that into the same array, find
the
> parent of that folder, put that ID into the array, and keep doing that
till
> I reach the root folder. Then load the root folders and print them out
till
> I reach the root folder in the array, and then start branching out from
> there, listing the contents of the subfolders, and branching out the ones
> in the array...
>
> The reason I don't like to keep the level of the folder in the database is
> that I want to be able to move any and all folders around across levels in
> the database ... and keep their subfolders attached ...
>
> Sofar I'm a bit blank in regards to this .... especially because I'm doing
> it to figure out how to do it, but don't really have anything specific I
> want to use it for yet, that requires more than 2 level of folders...
>
>
> Rene
>
> --
> Rene Brehmer
> aka Metalbunny
>
> ~ If you don't like what I have to say ... don't read it ~
>
> http://metalbunny.net/
> References, tools, and other useful stuff...
> Check out the new Metalbunny forums @ http://forums.metalbunny.net/
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php