I've got an application where page-generation tags are passed a
configuration struct.  This struct contains a substruct.  What's the best
way to test for the existence of the substruct?

Right now I've got the following, which works, but I'm not sure it's
really best.

<cfif not IsDefined("attributes.cfg")>
  <cfset attributes.cfg = StructNew()>
</cfif>
<cfparam name="attributes.cfg.errorpage"       default="/error.cfm">
<cfparam name="attributes.cfg.banners"         default="yes"
type="boolean">

<cfif not IsDefined("attributes.cfg.subthing")>
  <cfset attributes.cfg.subthing = StructNew()>
</cfif>
<cfparam name="attributes.cfg.subthing.color"  default="#000000">
<cfparam name="attributes.cfg.subthing.value"  default="bob">
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to