Skip to main content
Participating Frequently
September 21, 2012
Question

method not found

  • September 21, 2012
  • 2 replies
  • 956 views

Cant work out why I am getting this error
The method getLatestThreads was not found in component forum.cfc.

Calling it from rss.cfm
<cfset data = application.forum.getLatestThreads(forumid=url.forumid)>

forum.cfc
<cffunction name="getLatestThreads" access="public" returnType="query" output="false"
hint="Retrieve the last 20 posts to any threads in forums in this forum.">
<cfargument name="forumid" type="uuid" required="true">
<cfset var qLatestThreads = "">

   <cffunction name="getLatestThreads" access="public" returnType="query" output="false"

                                        hint="Retrieve the last 20 posts to any threads in forums in this forum.">

                    <cfargument name="forumid" type="uuid" required="true">

                    <cfset var qLatestThreads = "">

 

                    <cfquery name="qLatestThreads" datasource="#variables.dsn#">

                              <cfif variables.dbtype is "oracle">

                      select * from (

                  </cfif>

                              select

                                        <cfif not listFindNoCase("mysql,oracle",variables.dbtype)>

                                        top 20

                                        </cfif>

                                                            #variables.tableprefix#messages.title, #variables.tableprefix#threads.name as thread,

                                                            #variables.tableprefix#messages.posted, #variables.tableprefix#users.username,

                                                            #variables.tableprefix#messages.threadidfk as threadid,

                                                            #variables.tableprefix#messages.body,

                                                            #variables.tableprefix#threads.forumidfk,

                                                            #variables.tableprefix#forums.conferenceidfk

                              from                    #variables.tableprefix#messages, #variables.tableprefix#threads, #variables.tableprefix#users, #variables.tableprefix#forums

                              where                    #variables.tableprefix#messages.threadidfk = #variables.tableprefix#threads.id

                              and                              #variables.tableprefix#messages.useridfk = #variables.tableprefix#users.id

                              and                              #variables.tableprefix#threads.forumidfk = <cfqueryparam value="#arguments.forumid#" cfsqltype="CF_SQL_VARCHAR" maxlength="35">

                              and                              #variables.tableprefix#forums.conferenceidfk = #variables.tableprefix#conferences.id

                              order by          #variables.tableprefix#messages.posted desc

                                        <cfif variables.dbtype is "mysql">

                                        limit 20

            <cfelseif variables.dbtype is "oracle">

                      ) where rownum <= 20

                  </cfif>

                    </cfquery>

 

                    <cfreturn qLatestThreads>

          </cffunction>

    This topic has been closed for replies.

    2 replies

    Inspiring
    September 21, 2012

    Why are you using the application scope to call your cfc?

    chuck1rarAuthor
    Participating Frequently
    September 22, 2012

    Resolved application needed refreshing...

    Inspiring
    September 21, 2012

    What is the value of  application.forum?

    --

    Adam