I'd like to see what you have if I could.

Robert Everland III
Dixon Ticonderoga
Web Developer Extraordinaire

-----Original Message-----
From: Chris Combs [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 28, 2002 2:03 PM
To: CF_OpenSource
Subject: RE: doing a content mangement system, very simple need some
ideas


I have also used the nested tree concept (or BOM structures) to do orgcharts
using HTML/CSS. It works pretty well and if a CMS were org-based, could be
used for security, structure, etc.

-----Original Message-----
From: Robert Everland [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 28, 2002 12:45 PM
To: CF_OpenSource
Subject: RE: doing a content mangement system, very simple need some
ideas


I am messing with the nested tables, they are pretty nice, the problem I am
having is this though, I am using a couple different tags to sort out the
queries so it will work right spaced out, they just don't have a level on
them so that I can easily sort them. Maybe I will have to make my own,
search for make tree in the tag gallery, they are pretty nice.

Robert Everland III
Dixon Ticonderoga
Web Developer Extraordinaire

-----Original Message-----
From: Stephen Moretti [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 28, 2002 12:16 PM
To: CF_OpenSource
Subject: Re: doing a content mangement system, very simple need some
ideas


Robert,

> Well it's nice to have a system where I could have infinite levels, then I
> could limit it myself to where I think the project will be headed. I don't
> want to have to worry about redesigning a database structure if the scope
of
> the project changes and now they want 6 subcategorys and not 5.
>

What you're talking about is the Nested Tree Model...

Have a look at this : http://www.codebits.com/ntm/ for more information.

I've done this before for a simple tree using a recursive tag.  I have to be
honest and say that in hindsight the tag was a bit on the naff side and
isn't very transferable (other than the theory) to new applications, because
it was set up to do something specific for one application.
Basically, what I had was a category table with various fields to do with
the category specifically, plus a parentid field.  The parentid field was
set to zero if the category was at the top level or the id of the category
to which it was a subcategory.
Incidentally, this is the very lowest level of complexity behind the Nested
Tree Model.
Anyway, the tag was intended to output a suitably indented list of all the
categories and links to the "editor" for the category from a given category
id (0 was the default i.e.. all categories would be listed).
To display child categories the tag would check to see if the current
category was used as the parent of any other categories and it was it called
itself passing the current category as the start point, until it reached a
point where there were no more child categories at which point the tag
worked its way back up out of the tree.

Let me see if I can remember how the tag went.....
<!--- This tag is called = <cf_indentcategory>
It has two parameters
   parentid : this is the id of the category at which to start a recursive
tree walk
   indentlevel : this sets the level of indent required for this call of the
tag
--->

<cfparam name="attributes.parentid" default="0">
<cfparam name="attributes.indentlevel" default="0">

<cfset indent = "&nbsp;&nbsp;">
<cfset currentindent = "">
<cfif attributes.indentlevel>
   <cfloop index="i" from="1" to="#attributes.indentlevel#">
      <cfset currentindent = currentindent&indent>
   </cfloop>
</cfif>

<cfquery name="currentcategory" datasource="mydsn">
   SELECT * FROM Category
   WHERE CategoryID = #attributes.parentid#
</cfquery>

<cfquery name="subcategory" datasource="mydsn">
   SELECT CategoryID FROM Category
   WHERE ParentID = #currentcategory.categoryid#
</cfquery>

<CFOUTPUT>
#CurrentIndent#<a
href="index.cfm?fuseaction=category.edit&categoryid=#currentcategory.categor
y#">#CategoryName#</a><BR>
</CFOUTPUT>

<CFIF subcategory.recordcount>
   <cfset nextindent = Increment(attributes.indentlevel)>
   <CFLOOP query="subcategory">
      <cf_indentcategory parentid="#subcategory.categoryid#"
indentlevel="#nextindent#">
   </CFLOOP>
</CFIF>

Bear in mind, before anyone comments, that I just wrote this off of the top
of my head, so there are likely to be errors in this code.  If there are and
you run this on your server, then you will bring your server to a dead halt,
because it will be stuck in an ever deepening infinite loop.  Honest gov, I
didn't that to our server at the time that I originally wrote this.....
Anyway, it should give you an idea of what I'm trying to get at.  Its not
very efficient, which is why you should look at the NTM stuff written by
David Medinets. ;o)

Regards

Stephen



______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to