hello,
im working on creating the algorithm for a threaded forum, and so far, its been able to display messages until a thread ends, at which point it doesn't 'remember' how to go back to another higher level which may or may not have replies. im not sure how to handle this, since i dont think CF lets u 'return'.
the first page referenced is the index.cfm, which sets a couple basic variables, then passes them on to a file called kfill.cfm, which basically calls itself to populate the forum messages.
//*********** index.cfm ************\
<!--- sets the first post to zero --->
<cfparam name="parentNode" default="0">
<cfparam name="fosterNode" default="0">
<cfparam name="fToken#fosterNode#" default="0">
<!--- sets the level of the first post to zero --->
<cfparam name="postToken" default="0">
<!--- begin to fill the forum --->
<cfinclude template="kfill.cfm">
</body>
</html>
//************ kfill.cfm ************\
<!--- get all messages that are replies to the current message --->
<cfquery datasource="forum" name="getMes">
select * from messages
where reply=#parentNode#
</cfquery>
<cfoutput query="getMes">
<cfif getMes.recordCount NEQ 0>
<cfset parentNode=#ID#>
<ul><li>#subject#
<cfinclude template="kfill.cfm">
<cfelseif getMes.recordCount EQ 0>
</ul>
</cfif>
<cfinclude template="kfill.cfm">
<!--- put something here to make code work? --->
</cfoutput>
// ****** end ******\
thanks, any help would be appreciated.
- nem
im working on creating the algorithm for a threaded forum, and so far, its been able to display messages until a thread ends, at which point it doesn't 'remember' how to go back to another higher level which may or may not have replies. im not sure how to handle this, since i dont think CF lets u 'return'.
the first page referenced is the index.cfm, which sets a couple basic variables, then passes them on to a file called kfill.cfm, which basically calls itself to populate the forum messages.
//*********** index.cfm ************\
<!--- sets the first post to zero --->
<cfparam name="parentNode" default="0">
<cfparam name="fosterNode" default="0">
<cfparam name="fToken#fosterNode#" default="0">
<!--- sets the level of the first post to zero --->
<cfparam name="postToken" default="0">
<!--- begin to fill the forum --->
<cfinclude template="kfill.cfm">
</body>
</html>
//************ kfill.cfm ************\
<!--- get all messages that are replies to the current message --->
<cfquery datasource="forum" name="getMes">
select * from messages
where reply=#parentNode#
</cfquery>
<cfoutput query="getMes">
<cfif getMes.recordCount NEQ 0>
<cfset parentNode=#ID#>
<ul><li>#subject#
<cfinclude template="kfill.cfm">
<cfelseif getMes.recordCount EQ 0>
</ul>
</cfif>
<cfinclude template="kfill.cfm">
<!--- put something here to make code work? --->
</cfoutput>
// ****** end ******\
thanks, any help would be appreciated.
- nem