scopecoldfusioncfccoldfusion-2016

Variables. scope inside of a cfmodule


I have a page with a name of

summary.cfm

inside of it:

 <cfinclude template="view/totals.cfm>

view/totals.cfm

inside of it:

variables.grandTotalHTML = invoke("viewtotals, "doSummary", {...});

view/viewtotals.cfc

inside of it

<cfmodule template="summarytemplate.cfm" ...>
<!--- database is not passed in here --->

view/summarytemplate.cfm

Inside of it we have

param attributes.database = session.database;
...
databaseoverride = attributes.database;
...

<cfquery name="qData">
   SELECT *
   FROM [#variables.databaseoverride#]
   ...
</cfquery>

Now question

I don't know where the databaseoverride is coming from.

  1. Does global page request scope?
  2. Does it come from variables in viewtotals.cfc ?
  3. Does the unscoped version override it?

Solution

  • (Too long for comments)

    Just to elaborate on Dan's answer:

    summary.cfm

    view/totals.cfm

    view/viewTotals.cfc

    view/summaryTemplate.cfm

    ( The REQUEST scope is accessible to all of the scripts above.)