CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Forum question

Print topic Send  topic

Author Message
question
Posted: 10/28/2003, 12:29 PM

Have a quetion on The forum application .
When someone replies to a thread it does update but when you go to the front of the foum you won't see that replier--all you see is the orginal author.
SO there is no way of telling whether someone has replied to a thread or not..
Anyone noticed that?
Any solution...
Thank you.
question
Posted: 10/30/2003, 12:32 PM

Any answer to the question above????
RonB
Posted: 10/30/2003, 1:11 PM

add a label and do a before show event. In the event do a database call gettting the sum of replies for that message_id and assign this value to the label.

Ron
question
Posted: 11/09/2003, 10:45 PM

Thanks but how do you that in code?
Yes I can also include the count of replies.
But it will be great to show the last author.


"<CFOUTPUT>
#HTMLEditFormat(flddate_entered)#</CFOUTPUT>" this line displays the date entered. But it is displaying the original date.

In the database table (access) there is a field called "message_id" and "message_parent_id" among others.
message_id is an auto field, and is incremented as new thread is created.
When someone replies then, the message_parent_id field will be populated.
For example lets say I create a new thread. Then a new record will be created where message_id will get a value "1" (assuming that this is first thread).
At this time message_parent_id is blank.
Then someone comes and replies to that thread, then another record is created where "message_id" gets a value "2" and "message_parent_id" gets the value "1" (the value of message_id when the new thread was created).
So I would like to display the date entered from the second record.
How do you do that?


Here is a piece of code that displays the front page of the forum. Please read the


<CFSET sWhere="">
<CFSET sOrder="">
<CFSET sSQL="">



<cfquery datasource="somename" name="get">
SELECT MAX(date_entered) AS ThisID
FROM messages
</cfquery>





<CFPARAM NAME="TransitParams" DEFAULT="">

<CFPARAM NAME="s_topic" DEFAULT="">
<CFSET TransitParams=TransitParams & "s_topic=" & URLEncodedFormat(s_topic) & "&">

<CFPARAM NAME="s_topic" DEFAULT="">
<CFSET FormParams="s_topic=" & URLEncodedFormat(s_topic) & "&">
<CFSET HasParam = "FALSE">



<CFPARAM NAME = "s_topic" DEFAULT="">
<CFSET ps_topic = s_topic>

<CFIF ps_topic NEQ "">
<CFSET HasParam = "TRUE">
<CFSET sWhere= "m.topic like '%" & replace(ps_topic, "'", "''") & "%'" & " or " & "m.message like '%" & replace(ps_topic, "'", "''") & "%'">

</CFIF>

<CFIF HasParam EQ "TRUE">
<CFSET sWhere = " WHERE (message_parent_id is null) AND (" & sWhere & ")">
<CFELSE>
<CFSET sWhere = " WHERE message_parent_id is null">
</CFIF>



<CFPARAM name="sDirection" Default="">


<CFSET sOrder = " order by m.date_entered Desc">


<CFPARAM name="FormMessages_Sorting" Default="">
<CFPARAM name="FormMessages_Sorted" Default="">

<CFPARAM NAME="SortParams" DEFAULT="">

<CFPARAM NAME="sSortParams" DEFAULT="">

<CFSET iSort=#FormMessages_Sorting#>
<CFSET iSorted=#FormMessages_Sorted#>
<CFSET sDirection="">

<CFIF iSort EQ "">
<CFSET Form_Sorting="">
<CFELSE>
<CFIF iSort EQ iSorted>
<CFSET Form_Sorting="">
<CFSET sDirection=" DESC">
<CFSET sSortParams = "FormMessages_Sorting=" & iSort & "&FormMessages_Sorted=" & iSort & "&">
<CFELSE>
<CFSET Form_Sorting=iSort>
<CFSET sDirection=" ASC">
<CFSET sSortParams = "FormMessages_Sorting=" & iSort & "&FormMessages_Sorted=" & "&">
</CFIF>


<CFIF iSort EQ 1><CFSET sOrder = " order by m.topic" & sDirection></CFIF>
<CFIF iSort EQ 2><CFSET sOrder = " order by m.author" & sDirection></CFIF>
<CFIF iSort EQ 3><CFSET sOrder = " order by m.date_entered" & sDirection></CFIF>
</CFIF>

<CFSET sSQL = "select m.author as m_author, m.date_entered as m_date_entered, m.message as m_message, m.message_id as m_message_id, m.topic as m_topic from messages m ">

<CFSET sSQL = sSQL & sWhere & sOrder ><CFSET FormAction="newthread.cfm"><CFSET SortParams=sSortParams>
<table border="0" cellspacing="1" cellpadding="3">

<tr><td bgcolor="#c2c2c2" colspan="4"><a name="Messages"><font face="arial" style="font:bold" color="#0033cc">Discussions</font></a></td></tr>
<tr>
<td bgcolor="#f2f2f2"><a ><font face="arial" size="2" style="font:bold" color="#0033cc"></font></a></td>
<td bgcolor="#f2f2f2"><a href="<CFOUTPUT>#FileName#?#FormParams#</CFOUTPUT>FormMessages_Sorting=1&FormMessages_Sorted=<CFOUTPUT>#Form_Sorting#</CFOUTPUT>&"><font face="arial" size="2" style="font:bold" color="#0033cc">Thread</font></a></td>
<td bgcolor="#f2f2f2"><a href="<CFOUTPUT>#FileName#?#FormParams#</CFOUTPUT>FormMessages_Sorting=2&FormMessages_Sorted=<CFOUTPUT>#Form_Sorting#</CFOUTPUT>&"><font face="arial" size="2" style="font:bold" color="#0033cc">Author</font></a></td>
<td bgcolor="#f2f2f2"><a href="<CFOUTPUT>#FileName#?#FormParams#</CFOUTPUT>FormMessages_Sorting=3&FormMessages_Sorted=<CFOUTPUT>#Form_Sorting#</CFOUTPUT>&"><font face="arial" size="2" style="font:bold" color="#0033cc">Date Entered</font></a></td>
</tr><CF_GETPARAM NAME = "FormMessages_Page">
<CFSET iPage=PARAM_VAL>
<CFIF iPage EQ "" > <CFSET iPage=1> </CFIF>
<CFSET RecordsPerPage = 25 >


<CF_OPENRS APP_NAME="#APP_NAME#" NAME="Messages" SQL=#sSQL#>

<CFIF queryMessages.RECORDCOUNT GT 0>



<CFSET Start_row=(iPage-1)*RecordsPerPage+1>
<CFSET End_row=iPage*RecordsPerPage>
<CFLOOP QUERY="queryMessages" STARTROW="#Start_row#" ENDROW="#End_row#">

<CFSET fldmessage_id = m_message_id>
<CFSET fldtopic = m_topic>
<CFSET fldauthor = m_author>
<CFSET flddate_entered = m_date_entered>
<CFSET fldField1= "<img src=images/Thread_small.gif>">

<tr><td >
<font face="arial" size="2"><CFOUTPUT>#fldField1#</CFOUTPUT> </font></td><td ><a href="viewthread.cfm?mid=<CFOUTPUT>#URLEncodedFormat(queryMessages.m_message_id)#</CFOUTPUT>&"><font face="arial" size="2"><CFOUTPUT>#HTMLEditFormat(fldtopic)#</cfoutput></font></a> </td><td >
<font face="arial" size="2"><CFOUTPUT>#HTMLEditFormat(fldauthor)#</CFOUTPUT> </font></td>


<td >
<font face="arial" size="2"><CFOUTPUT>


#HTMLEditFormat(flddate_entered)#</CFOUTPUT> </font> </td></tr>

</CFLOOP>


---------



Re
Posted: 11/09/2003, 11:48 PM

I do not know any coldfusion but you should be able to piece it together with this:

as I said use the beforeshow event on an extra label. set source for that label to code expression. Use the CCGetDBValue() function to get the info you want. The sql statement for the function would be something like this:
select count(*) from table where parent_id = message_id replace message_id with the value of the message id for wich you want to count the replies.


Ron

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.