|
Posted by Oli Filth on 05/30/06 11:20
leonardo.calado@gmail.com said the following on 30/05/2006 12:13:
>
> I make chages add this fields to make a breadcrumbs functionality from
> this system in the following fields I have stored this data:
>
> page_id page_path page_depth page_order page_has_childs
> page_title
> 1 x 1 0 1 Home
> 2 x.1 2 0 1 Products
> 3 x.1 2 2 0 3D Cad
> 9 x.1.2 3 2 0 Contact
> 10 x.1.2 3 0 0 Knowledge
>
> In page path I store the location from that row data, for example in
> page_id 10, I have the following path x(Home), 1(Products) and
> 2(Knowledge). In breadcrumbs I'm show like this Home > Products >
> Knowledge.
I'm not sure I understand your page_path system. Why does 1 mean
"Products" and 2 mean "Knowledge"?
The way I would do it is for each page, store the ID of its "parent", i.e.:
page_id parent_id title
---------------------------------
1 NULL Home
2 1 Products
3 1 3D Cad
9 2 Contact
10 2 Knowledge
That way, you can read the entire table into a PHP array, and then step
through the array to build up a tree data structure.
--
Oli
[Back to original message]
|