This content has been marked as final. Show 4 replies
As a matter of reuse I would replace all the global and scoped variables in your functions with arguments or create them internally. E.g.:
<cfargument name="Mode" required="yes" type="string">
<cfargument name="EmailAddress" required="yes" type="string">
<cfargument name="LogFileInfo" required="yes" type="string">
<cfset var CreateLogDate = DateFormat(Now(), "mm/dd/yyyy">
<cfset var CreateLogTime= TimeFormat(Now(), "hh:mm:ss tt">
When you have global variables, form varaibles and other scoped variables in your function you are not encapsulating your function, you are making it dependent on the existance of these variables. This is turn will cause headaches with reusing this function as well cause potential bugs.
In any regard you may want to look into the tag <cflog> which does alot of writing the log for you.
change arguements to arguments
Is there a way to add a <cfif> to the mix? If I make the cffunction
<cfargument name="Mode" required="no" type="string">
<cfset LogFileInfo="#CreateLogDate# #CreateLogTime# - #Arguments.Mode# has
been created for email address: #form.Email#">
Since the arguement isn't required, I'd like to test to see if there is a
value there. If not, I'll use a different value in the cfset.....
Can this be done? If so, are you using <cfif> on Argument.Mode???
"Dan Bracuk" <firstname.lastname@example.org> wrote in message
> change arguements to arguments
You can use either cfif or cfparam with the arguments scope exactly the same way you use it for any other scope.