[thelist] CF: form. Url. Attributes. A better way?
Joshua OIson
joshua at alphashop.net
Sun Jan 14 21:08:34 CST 2001
Mis-answered. I reread your post and I think I answered your question
incorrectly.
Jeff's comments on the attributes tag are correct... it's not a valid scope
except within a custom tag or module.
But, to answer your post directly, you need to keep in mind that CF
automatically maps URL and Form variables to the "unscoped" variable. So,
you COULD do this:
<cfparam name="attributes.id" value="0"> <!--- Whatever you want
the default to be for the
whole shebang goes in
the first cfparam --->
<cfparam name="id" value="#attributes.id#">
Then use the variable "id".
And that would do exactly what your code did, except that it would not
introduce the "TheID" variable.
-joshua
----- Original Message -----
From: "Frank" <framar at interlog.com>
To: <thelist at lists.evolt.org>
Sent: Sunday, January 14, 2001 5:04 PM
Subject: [thelist] CF: form. Url. Attributes. A better way?
>
> I'm trying to create scheme where everything is pretty modular,
> almost object oriented. I break my queries apart from the logic, so
> that any number of display modules can call to them. What I tend to
> end up doing it this:
>
> <cfif IsDefined("URL.ID")>
> <cfset TheID = "#URL.ID#">
>
> <cfelsif IsDefined("Form.ID")>
> <cfset TheID = "#Form.ID#">
>
> <cfelseif IsDefined("Attributes.ID")>
> <cfset TheID = "#Attributes.ID#">
>
> </cfif>
>
> Use: #TheID#
>
> This seems rather clumsy to me. Does anyone have a better of getting
> the correct scope for a variable without having to redefine them each
> time on every query?
> --
>
> Frank Marion Loofah Communications
> frank at loofahcom.com http://www.loofahcom.com
>
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !
>
More information about the thelist
mailing list