What can I do in fetch_records?

I
n all pages, one would not want to display the entire tree. For e.g. in the Linux page, one does not want the Windows,VMWare,FreeBSD links to show up. What we want to do is to be able to prune the tree and get the subtree rooted at linux. This is easily accomplished in fetch_records. Just select all the records from the table whose absolute path starts with "/linux/". The additional "/" makes sure you dont get "/linuxdoc" or some such thing. Optionally you also might want to get the record for "/linux". This still does not accomplish our task, the forest control will consider /linux to be at level 2, instead of being the root. This is where post processing in fetch_records is useful. Since forestcontrol, takes the field which contains the absolute path name as an argument, we can create a new field, say "node_path" which is just all the absolute path names, but with the leading "/linux" stripped of. With this we have the effect of considering only the subtree rooted under linux. Dont change the original field "path_desc", because that will be needed to generate hyper links.

There can be more than one forestcontrol in a page (I dont have an actual instance of such a page), each one of them calls the same fetch_records function which is part of your display class. In order to help distinguish, fetch_records is passed in a parameter which the name of the field which has the path information. So in the previous example, fetch_records is passed the value "node_path" as an argument. YOu can use this to distinguish different controls. I dont expect the need to have multiple forestcontrols in one page anytime soon though.