Correct. If you are <CFInclude>ing a file, the URL parameters of the
calling template will be included as well. Think of a CFInclude as nothing
more than code that *could* be written into the including page itself.
If you aren't familiar with C, take this example:
You have a calling file that looks like this:
<cfparam name = URL.bob default = "2">
<cfset URL.bob = #Val(URL.bob)#>
<cfinclude template="this_page.cfm">
and "this_page.cfm" looks like this:
<cfquery name="qryBob" datasource="#DSN#">
SELECT first_name
FROM table
WHERE bob_id = #URL.bob#
</cfquery>
<cfoutput>
Hi #qryBob.first_name#
</cfoutput>
it *could* also be written as:
<cfparam name = URL.bob default = "2">
<cfset URL.bob = #Val(URL.bob)#>
<cfquery name="qryBob" datasource="#DSN#">
SELECT first_name
FROM table
WHERE bob_id = #URL.bob#
</cfquery>
<cfoutput>
Hi #qryBob.first_name#
</cfoutput>
The "this_page.cfm" file knows what URL.bob is from the including page that
included it. Anything else, it doesn't know about. I understand where one
would expect the included file to parse its own URL variables, but actually,
no URL variables are passed to the included page, in your example, so it
just has no idea what they are .. any URL variables *have* to be passed from
one server interaction to another to be recognized.
If you want to use URL variables in your included pages, just be sure that
the including page knows about them so it can share the values with the
included one, since to CF, they are one and the same. Otherwise, you need
to make the included page a custom tag and pass the 'URL variables' to the
that tag as parameters. This rather shortens the gap, and even makes a
bridge, between including a file and making that file a custom tag. This is
a core of my own methodology.
There is always a way to make this happen if you code your CF apps.
optimally :)
Todd Ashworth
----- Original Message -----
From: "Jared Clinton" <[EMAIL PROTECTED]>
To: "Fusebox" <[EMAIL PROTECTED]>
Sent: Tuesday, November 21, 2000 8:29 PM
Subject: RE: Passing URL Parameters in CFINCLUDE
> There is no point in 'including' url parameters.
>
> think of it like a #include in c .. it just does a macro include of the
> file.
>
> the url parameters are still in scope within the included file.
>
> Jared Clinton
> Maxi Multimedia.
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, 22 November 2000 9:37
> > To: Fusebox
> > Subject: RE: Passing URL Parameters in CFINCLUDE
> >
> >
> > Looks like a good time to use a custom tag.
> >
> > Rick
> >
> > -----Original Message-----
> > From: Greg Wolfinger [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, November 21, 2000 3:41 AM
> > To: Fusebox
> > Subject: Passing URL Parameters in CFINCLUDE
> >
> >
> > This is a multi-part message in MIME format.
> >
> > ------=_NextPart_000_0007_01C05375.47FB3B60
> > Content-Type: text/plain;
> > charset="iso-8859-1"
> > Content-Transfer-Encoding: quoted-printable
> >
> > Hey Guys:
> >
> > I was wondering if it is possible to cfinclude URL parameters. I am =
> > getting an error message when I do, but I'm not sure if that is the =
> > reason. My cfinclude statements looks like this:
> >
> > <cfinclude template="search/index.cfm?action=3Dblock">
> >
> > Thanx,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists