> -----Original Message----- > From: Abraham Hertzberg III [mailto:[EMAIL PROTECTED] > Sent: Sunday, August 07, 2005 1:18 PM > To: CF-Community > Subject: spidering a site > > I have to do up a script that will spider a site... and create a > sitemap... > > any suggestions as to what type of object is the best to hold the > information until i write the actual file? > > array of structures > structures of arrays > array of arrays... ?? > > any suggestions?
It kind of depends on the information you want to store. To do my sitemap and navigation and such I use two components: a collection called "DP_NavigationElements" and a component representing a single point in navigation called "DP_NavigationElement". They're here in this package here: http://www.depressedpress.com/DepressedPress/Content/Development/ColdFusion/ DPLibraries/Documentation/cfc_DepressedPress.Framework_Catalog.cfm The two are somewhat redundant. Any navigation element has a property called "Children": this is an array of references to other NavigationElements. In this way an entire site can be represented either as several top-level elements or as a single "site" element containing all of the top-level children. The NavigationElements collection on the other hand doesn't care about order or relationship: it's a flat collection of references to all the elements. In this way I can recurse over an element to display something like a sitemap, but I still have instant access to any element via the collection. In your case, to just build a site map, you may not need the collection at all. I'm not sure if the component are useful to you as is - they're designed more for managing whole-site navigation (at DepressedPress.com they're instantiated once then used to construct the site-map, the breadcrumb trail and the left navigation). But some of the methods like "GetAncestorArray()" are worth looking at if you're not used to recursion - once you get a handle on recursion in contexts like this most of the big problems just dissolve away. Jim Davis ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:5:168301 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/5 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:5 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.5 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
