From: Richard :o <ma...@ri...> - 2001-01-12 14:08:07
|
Hi, >But I still have some problems with the > recursive function that I use to build the tree. I will be working on it... In case it can be of aid, I'll just explain how I build the tree from php: I cut out all the code which checks file-dates etc, just left ideas for building the tree: <?php function listall($dir){ print("node=myTree.add('$dir');\n"); //This prints the first subnode, don't forget the \n for new line $handle = @opendir($dir) or die("Directory \"$dir\"not found."); //In my case this opens a directory, you would open the DB before the function while (false!==($file = readdir($handle))) { // read all files in dir, you would loop through the records $myImg="nodeImage.gif"; //You could get this value from a record. print("node.addNodeContent('$file','javascript: popup(\'$dir/$file\',\'new\')',$myImg);\n"); //This writes the content, (we are looping through the records) //The first parameter == nodeCaption //the next one is the url, I call a javascript function on the page (client-side) //the main problem is \'ing the right parentheses (') //the last one is the node image. //so after processing the source looks like this: //node.addNodeContent('the node title','javascript: popup(\'send any parameters here\')','nodeImage.gif'); }; print("node.closeContent();\n"); //After the while loop we close the node content. closedir($handle); //In my case this closes the directory, you would close the //DB after all the nodes have been added }; ?> //end of php Note: I don't actually change the node name, because the dynlayers name themselves anyway, and we don't need to reference these childlayers afterwards. then in you DynAPI source you do this: myTree = new RiFastSkinTreenode(50,50,400,'DynAPI2 Examples',theme,25) myTree.setColor("#123456") //start php script to insert directory values into tree <? listall('../Richard_Examples'); listall('../Pascal_Bestebroer_Dynacore_Examples'); listall('../Dan_Steinman_Examples'); listall('../il_Maestro_Examples'); listall('../Martin_Strom_Examples'); listall('../Peter_Dvorsky_Examples'); listall('../Henrik_Vaglin_Examples'); listall('../Glen_Deas_Examples'); listall('../Christopher_Go_Examples'); listall('../Nuno_Ferreira_Examples'); ?>; //end php script to insert directory values into tree scrollobj2 = new ScrollPane(myTree) // tree will be set as the content scrollobj2.setSize(500/q,420/q) scrollobj2.moveTo(250/q,200/q) scrollobj2.setBgColor('#000000') DynAPI.document.addChild(scrollobj2) myTree.setVisible(true) function popup(mylink, windowname) //code to load the url into a loadpanel to display the info } That's about it, I'm sure you know most of this anyway, and there's many ways to do it. If you could document how you access the mySql database, and write contents to the tree, I'll make a section on php/DynAPI, 'cause I haven't tried that myself yet. Sorry to burden the rest with +-unrelated code. Cheers, Richard :o ma...@ri... www.richardinfo.com (Everything running on, and ported to the 19/12/2000 snapshot of DynAPI2) ----- Original Message ----- From: "Nuno Ferreira" <nun...@wi...> To: <dyn...@li...> Sent: Friday, January 12, 2001 1:57 PM Subject: RE: [Dynapi-Dev] DynAPI Reference... > Hi Richard, > > >But that's not the case, either you didn't read the documentation > properly, > >or I didn't explain it very well. > > Nahhh, just my lazy side showing :) > Seriously, I didn't read it carefully enough. > > Thanks for explaining it clearly. > I'm rewriting it now. > > >Another thing is that you're using the latest release I suspect, instead > of > >the latest snapshot (or my one), so you are documenting some extensions > that > >don't exist any more, like sprite.js. > > Yup. I didn't know if everybody (like me) always goes for the beta instead > of the latest release. So I played it safe. :) > Anyway, I did it in PHP/MySQL but I come across some problems setting up the > online > database, so I opted for a HTML version of it for now. But the next version > will > definitely be PHP driven (as you could see it's a lot of methods!) > > >Of course if you are willing to update it regularly, I'd be more than > happy > >to put it on the site (or mirror it) if you want. > > Yeah, I'm willing to do update it, though at this stage it's just a list of > methods. > I will appreciate if you mirror it, as long as people understand that right > now it's > work in progress (but then again, what isn't?). > > Of course what I want is for each link to have it's own page, describing it > with parameters and examples. That's another reason that I used the latest > release > and not a beta, to have a stable (in terms of functionality) version to > develop on. > > >Oh, I almost forgot to say, I already rewrote it with the correct code, it > >renders in about 4 seconds now (download time not included) > >check here: > > Yikes! That's... wonderful. Thanks Richard! > > >If you decide to finish this job, it might be worth considering if you > can't > >include the values from text files or something (or through php), so you > >don't have to edit your html each time. This is what I did for my > "examples" > >tree, all the code is written on the fly by a php script, which checks the > >contents of directories on the server, and adds the nodes it needs. > > I've got a version of it working locally on my comp that accesses a MySQL > database > where all the nodes are stored in a tree (each node or link has a ID, and a > parent_ID, > with parent_ID=0 being a top node). But I still have some problems with the > recursive function that I use to build the tree. I will be working on it > more > thouroughly though, and building a simple backoffice to update it more > easily. > > thanks for excelent help, > > Nuno Ferreira > > > _______________________________________________ > Dynapi-Dev mailing list > Dyn...@li... > http://lists.sourceforge.net/lists/listinfo/dynapi-dev > ____________________________________________________________ > Get your free domain name and domain-based e-mail from > Namezero.com. New! Namezero Plus domains now available. > Find out more at: http://www.namezero.com > |