CFModule, is this even possible?

I’m breaking my head over something of which I’m not even sure if it’s possible? I’m working on a site with lots of pages. The content for all different pages is stored in the database. What I try is to have 1 custom tag(cfmodule) for all pages and use an attribute to identify which content should be displayed on a particular page. But I tried everything and the funny thing is I don’t get an error, it simply displays the first record of the database on each page.

So my question is how should my query and cfmodule be used to accomplish this?

Note: I would prefer not to use Url variables!

your query would retrieve the content from the database based on what page it is being called from, i.e. using #GetFileFromPath(GetCurrentTemplatePath())#

i’m afraid i don’t know what a cfmodule is

Hi Rudy.

<cfmodule> is the same as <cf_customTag>, but since I don’t have access to the Administrator on the server to set mappings I use <cfmodule> instead. What I have is the following:


<cffunction name="getContent" returntype="query">
  <cfargument name="dsn" type="string" required="true" />
  <cfset var getContent = "" />
  <cfparam name="attributes.result" default="0">
    <cfquery name="getContent" datasource="#arguments.dsn#">
      SELECT
           content_id
        , heading_gr 
        , heading_eng
        , content_gr
        , content_eng
      FROM
          content_pages
      WHERE
          content_id IN ( <cfqueryparam cfsqltype="cf_sql_integer" value="#Trim( attributes.result )#" /> )        
    </cfquery>    
  <cfreturn getContent>    
</cffunction> 

And on the page, inn this case insurance.cfm, in <cfmodule> I use the attribute result to retrieve the right data:


<cfmodule 
  template="modules/site/content.cfm" 
  result="5">

Where 5 is content_id in the database for insurance