RE: Adding custom functions to core
I've always wanted to be able to do something like this also. Maybe someone should make a wish list item for a directory were we can put functions and they would be used as if they were part of the ColdFusion functions. Steve -Original Message- From: Larry Lyons [mailto:[EMAIL PROTECTED] Sent: Monday, October 29, 2007 10:14 PM To: CF-Talk Subject: Re: Adding custom functions to core That's for tags, not functions. What about the base component? Correct me if I'm wrong but while it does not fit with all the restrictions the base component automatically inherited by all components. So you might be able to use this for your UDF's. ~| ColdFusion is delivering applications solutions at at top companies around the world in government. Find out how and where now http://www.adobe.com/cfusion/showcase/index.cfm?event=finderproductID=1522loc=en_us Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292315 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Adding custom functions to core
What you are suggesting would be a nice feature. I cache certain global functions in the server scope or the application scope, which is fairly close to what you are trying to achieve. So throughout the application, I always have available server.fcn.X and application.fcn.Y, without having to load in a UDF on every page call. -Mike Chabot On 10/29/07, Nicholas Vacek [EMAIL PROTECTED] wrote: Is there a way to add custom functions to ColdFusion, so that I can reference them without having to put them in a cfc or cfm page? For instance, I've written a simple, user-defined function. But I don't want to save it in the Application or Request scope, because it needs to be available within my CFCs - And I don't want to pass the function into every CFC, because that's a pain. I want my function to be available _everywhere_ within my application, just like a normal function. In fact, I'd like it if my function was available everywhere to every application, on my server. Is this possible? Has anyone ever hacked the ColdFusion core to add their own custom functions? ~| Get involved in the latest ColdFusion discussions, product development sharing, and articles on the Adobe Labs wiki. http://labs/adobe.com/wiki/index.php/ColdFusion_8 Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292343 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Adding custom functions to core
I just create a Utility CFC and pass that into any CFCs that need it (or have ColdSpring do it for me since I am lazy), as well as place it in the variables scope so that normal CF templates can use it as well. It's not the automatic solution being asked for but it's really not much extra work and it does the job fine. On Oct 30, 2007 8:35 AM, DURETTE, STEVEN J (ATTASIAIT) [EMAIL PROTECTED] wrote: I've always wanted to be able to do something like this also. Maybe someone should make a wish list item for a directory were we can put functions and they would be used as if they were part of the ColdFusion functions. Steve ~| Get the answers you are looking for on the ColdFusion Labs Forum direct from active programmers and developers. http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72catid=648 Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292351 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Adding custom functions to core
Thanks everyone for all your suggestions on this! I'm currently using a Utility CFC, as Brian suggests. That works fine enough. I was just hoping for an even easier solution. Thanks again! Nicholas Vacek Vivid Image - Programmer 320-587-8974 ext. 111 [EMAIL PROTECTED] http://www.vimm.com Brian Kotek wrote: I just create a Utility CFC and pass that into any CFCs that need it (or have ColdSpring do it for me since I am lazy), as well as place it in the variables scope so that normal CF templates can use it as well. It's not the automatic solution being asked for but it's really not much extra work and it does the job fine. On Oct 30, 2007 8:35 AM, DURETTE, STEVEN J (ATTASIAIT) [EMAIL PROTECTED] wrote: I've always wanted to be able to do something like this also. Maybe someone should make a wish list item for a directory were we can put functions and they would be used as if they were part of the ColdFusion functions. Steve ~| ColdFusion is delivering applications solutions at at top companies around the world in government. Find out how and where now http://www.adobe.com/cfusion/showcase/index.cfm?event=finderproductID=1522loc=en_us Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292363 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Adding custom functions to core
Is there a way to add custom functions to ColdFusion, so that I can reference them without having to put them in a cfc or cfm page? For instance, I've written a simple, user-defined function. But I don't want to save it in the Application or Request scope, because it needs to be available within my CFCs - And I don't want to pass the function into every CFC, because that's a pain. I want my function to be available _everywhere_ within my application, just like a normal function. In fact, I'd like it if my function was available everywhere to every application, on my server. Is this possible? Has anyone ever hacked the ColdFusion core to add their own custom functions? -- Nicholas Vacek Vivid Image - Programmer 320-587-8974 ext. 111 [EMAIL PROTECTED] http://www.vimm.com ~| Download the latest ColdFusion 8 utilities including Report Builder, plug-ins for Eclipse and Dreamweaver updates. http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292267 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Adding custom functions to core
Yes you can, We do this via Application.cfc, using the following technique. The udf.cfm has all the common functions. !--- Request --- cffunction name=onRequest returnType=void output=true cfargument name=targetPage type=string required=true/ cfinclude template=#arguments.targetPage# /cffunction cfinclude template=/base/udf.cfm / /cfcomponent Regards Dale Fraser http://learncf.com -Original Message- From: Nicholas Vacek [mailto:[EMAIL PROTECTED] Sent: Tuesday, 30 October 2007 7:49 AM To: CF-Talk Subject: Adding custom functions to core Is there a way to add custom functions to ColdFusion, so that I can reference them without having to put them in a cfc or cfm page? For instance, I've written a simple, user-defined function. But I don't want to save it in the Application or Request scope, because it needs to be available within my CFCs - And I don't want to pass the function into every CFC, because that's a pain. I want my function to be available _everywhere_ within my application, just like a normal function. In fact, I'd like it if my function was available everywhere to every application, on my server. Is this possible? Has anyone ever hacked the ColdFusion core to add their own custom functions? -- Nicholas Vacek Vivid Image - Programmer 320-587-8974 ext. 111 [EMAIL PROTECTED] http://www.vimm.com ~| Check out the new features and enhancements in the latest product release - download the What's New PDF now http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292291 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Adding custom functions to core
That only includes the UDF into the variables scope of the requested page. They won't be present in CFCs, custom tags, etc. cheers, barneyb On 10/29/07, Dale Fraser [EMAIL PROTECTED] wrote: Yes you can, We do this via Application.cfc, using the following technique. The udf.cfm has all the common functions. !--- Request --- cffunction name=onRequest returnType=void output=true cfargument name=targetPage type=string required=true/ cfinclude template=#arguments.targetPage# /cffunction cfinclude template=/base/udf.cfm / /cfcomponent Regards Dale Fraser -- Barney Boisvert [EMAIL PROTECTED] http://www.barneyb.com/ Got Gmail? I have 100 invites. ~| Check out the new features and enhancements in the latest product release - download the What's New PDF now http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292295 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Adding custom functions to core
No hacking necessary, just place your tags in /WEB-INF/cftags. On 10/30/07, Nicholas Vacek [EMAIL PROTECTED] wrote: Is there a way to add custom functions to ColdFusion, so that I can reference them without having to put them in a cfc or cfm page? For instance, I've written a simple, user-defined function. But I don't want to save it in the Application or Request scope, because it needs to be available within my CFCs - And I don't want to pass the function into every CFC, because that's a pain. I want my function to be available _everywhere_ within my application, just like a normal function. In fact, I'd like it if my function was available everywhere to every application, on my server. Is this possible? Has anyone ever hacked the ColdFusion core to add their own custom functions? -- mxAjax / CFAjax docs and other useful articles: http://www.bifrost.com.au/blog/ ~| Download the latest ColdFusion 8 utilities including Report Builder, plug-ins for Eclipse and Dreamweaver updates. http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292294 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Adding custom functions to core
That's for tags, not functions. cheers, barneyb On 10/29/07, James Holmes [EMAIL PROTECTED] wrote: No hacking necessary, just place your tags in /WEB-INF/cftags. On 10/30/07, Nicholas Vacek [EMAIL PROTECTED] wrote: Is there a way to add custom functions to ColdFusion, so that I can reference them without having to put them in a cfc or cfm page? For instance, I've written a simple, user-defined function. But I don't want to save it in the Application or Request scope, because it needs to be available within my CFCs - And I don't want to pass the function into every CFC, because that's a pain. I want my function to be available _everywhere_ within my application, just like a normal function. In fact, I'd like it if my function was available everywhere to every application, on my server. Is this possible? Has anyone ever hacked the ColdFusion core to add their own custom functions? = -- Barney Boisvert [EMAIL PROTECTED] http://www.barneyb.com/ Got Gmail? I have 100 invites. ~| Download the latest ColdFusion 8 utilities including Report Builder, plug-ins for Eclipse and Dreamweaver updates. http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292297 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Adding custom functions to core
Ah, that'll teach me to half-read a question. On 10/30/07, Barney Boisvert [EMAIL PROTECTED] wrote: That's for tags, not functions. cheers, barneyb On 10/29/07, James Holmes [EMAIL PROTECTED] wrote: No hacking necessary, just place your tags in /WEB-INF/cftags. -- mxAjax / CFAjax docs and other useful articles: http://www.bifrost.com.au/blog/ ~| Check out the new features and enhancements in the latest product release - download the What's New PDF now http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292299 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Adding custom functions to core
That's for tags, not functions. What about the base component? Correct me if I'm wrong but while it does not fit with all the restrictions the base component automatically inherited by all components. So you might be able to use this for your UDF's. ~| Get involved in the latest ColdFusion discussions, product development sharing, and articles on the Adobe Labs wiki. http://labs/adobe.com/wiki/index.php/ColdFusion_8 Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292300 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
RE: Adding custom functions to core
I think you're referring to %ColdFusion%/WEB-INF/cftags/component.cfc Might want to give this a read first: http://www.briankotek.com/blog/index.cfm/2007/8/27/Base-CFCOMPONENT-Rant -Original Message- From: Larry Lyons [mailto:[EMAIL PROTECTED] Sent: Monday, October 29, 2007 9:14 PM To: CF-Talk Subject: Re: Adding custom functions to core That's for tags, not functions. What about the base component? Correct me if I'm wrong but while it does not fit with all the restrictions the base component automatically inherited by all components. So you might be able to use this for your UDF's. ~| ColdFusion 8 - Build next generation apps today, with easy PDF and Ajax features - download now http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292302 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Adding custom functions to core
On 10/29/07, Larry Lyons [EMAIL PROTECTED] wrote: What about the base component? Correct me if I'm wrong but while it does not fit with all the restrictions the base component automatically inherited by all components. So you might be able to use this for your UDF's. That would make the functions available inside any CFC but not inside CFM pages or custom tags etc. To be honest, using custom tags instead of UDFs is the easiest way to add functionality that is accessible in any file. And what's so horrible about saying this: cf_myFunction arg1=a arg2=123 result=foo / instead of: cfset foo = myFunction(arg1=a,arg2=123) / -- Sean A Corfield -- (904) 302-SEAN An Architect's View -- http://corfield.org/ If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Get the answers you are looking for on the ColdFusion Labs Forum direct from active programmers and developers. http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72catid=648 Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292303 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
CFDUMP var=variables shows custom functions?
I have an error tracker on my code that emails me a dump of just about everything. Today, on one site, I started including all of the CFLib.org files for all page requests rather than as needed. Nice idea, except that now my email error dumps are twenty times larger than before, all because the UDFs are listed in the 'variables' portion of the dump and list a complete function prototype. While this may be useful for some, I would prefer not to be receiving 1meg emails for each error. Is there any way to stop CFMX listing UDFs in the 'variables' scope? -- Damien McKenna - Web Developer - [EMAIL PROTECTED] The Limu Company - http://www.thelimucompany.com/ - 407-804-1014 #include stdjoke.h ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:187420 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: CFDUMP var=variables shows custom functions?
Copy them to the request or another scope, then delete their reference in the variables scope. Something like: cfset request.function1 = cflibFunc cfset structDelete(variables, cflibFunc) I'm not sure if this will work exactly as I have written it, however. One other solution is to store all of your page variables in a struct. Then, you can dump only that struct and ignore all other variables-scoped variables. M!ke -Original Message- From: Damien McKenna [mailto:[EMAIL PROTECTED] Sent: Monday, December 13, 2004 1:10 PM To: CF-Talk Subject: CFDUMP var=variables shows custom functions? I have an error tracker on my code that emails me a dump of just about everything. Today, on one site, I started including all of the CFLib.org files for all page requests rather than as needed. Nice idea, except that now my email error dumps are twenty times larger than before, all because the UDFs are listed in the 'variables' portion of the dump and list a complete function prototype. While this may be useful for some, I would prefer not to be receiving 1meg emails for each error. Is there any way to stop CFMX listing UDFs in the 'variables' scope? -- Damien McKenna - Web Developer - [EMAIL PROTECTED] The Limu Company - http://www.thelimucompany.com/ - 407-804-1014 #include stdjoke.h ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:187426 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: CFDUMP var=variables shows custom functions?
Could always change your dump function, to loop through the variables scope and do an isCustomFunction() check on each key if it is then remove that key form teh variables, if not leave it there. Then do teh dump function. Since it only happens when you get an error, it shouldnt take too much processesing, and you would not have to change yer code too much On Mon, 13 Dec 2004 13:32:32 -0600, Dawson, Michael [EMAIL PROTECTED] wrote: Copy them to the request or another scope, then delete their reference in the variables scope. Something like: cfset request.function1 = cflibFunc cfset structDelete(variables, cflibFunc) I'm not sure if this will work exactly as I have written it, however. One other solution is to store all of your page variables in a struct. Then, you can dump only that struct and ignore all other variables-scoped variables. M!ke -Original Message- From: Damien McKenna [mailto:[EMAIL PROTECTED] Sent: Monday, December 13, 2004 1:10 PM To: CF-Talk Subject: CFDUMP var=variables shows custom functions? I have an error tracker on my code that emails me a dump of just about everything. Today, on one site, I started including all of the CFLib.org files for all page requests rather than as needed. Nice idea, except that now my email error dumps are twenty times larger than before, all because the UDFs are listed in the 'variables' portion of the dump and list a complete function prototype. While this may be useful for some, I would prefer not to be receiving 1meg emails for each error. Is there any way to stop CFMX listing UDFs in the 'variables' scope? -- Damien McKenna - Web Developer - [EMAIL PROTECTED] The Limu Company - http://www.thelimucompany.com/ - 407-804-1014 #include stdjoke.h ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:187466 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Writing Custom Functions
What would be the scope of a UDF then? say udf.foo or function.foo? Bob Everland -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 30, 2001 3:05 PM To: CF-Talk Subject: RE: Writing Custom Functions Maybe I'm reading this wrong, but I have to ask - does this mean that one can, with CF5, set the code of a UDF into a variable, and then execute that UDF just by calling that variable in function syntax, and it automatically gets evaluated and run? Yes. Consider this: CFSCRIPT function foo() { return Your mother; } request.foo = foo; /CFSCRIPT You can then do: CFSET X = Request.Foo() or CFOUTPUT#Request.Foo()#/CFOUTPUT Just like 'normal' functions. Is that all the function keyword does - is create a variable for the function? Does this mean that we could theoretically use any variable as a function? You can't declare a function with a dot in the name. That's why I can't do, function request.foo I have to give it a 'normal' name first then copy it. You can also use IsCustomFunction to check if the function has been created. === Raymond Camden, Principal Spectra Compliance Engineer for Macromedia Email : [EMAIL PROTECTED] ICQ UIN : 3679482 My ally is the Force, and a powerful ally it is. - Yoda ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Writing Custom Functions
No scope unless it was directly loaded into something like the request or server scopes. What would be the scope of a UDF then? say udf.foo or function.foo? Bob Everland -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 30, 2001 3:05 PM To: CF-Talk Subject: RE: Writing Custom Functions Maybe I'm reading this wrong, but I have to ask - does this mean that one can, with CF5, set the code of a UDF into a variable, and then execute that UDF just by calling that variable in function syntax, and it automatically gets evaluated and run? Yes. Consider this: CFSCRIPT function foo() { return Your mother; } request.foo = foo; /CFSCRIPT You can then do: CFSET X = Request.Foo() or CFOUTPUT#Request.Foo()#/CFOUTPUT Just like 'normal' functions. Is that all the function keyword does - is create a variable for the function? Does this mean that we could theoretically use any variable as a function? You can't declare a function with a dot in the name. That's why I can't do, function request.foo I have to give it a 'normal' name first then copy it. You can also use IsCustomFunction to check if the function has been created. === Raymond Camden, Principal Spectra Compliance Engineer for Macromedia Email : [EMAIL PROTECTED] ICQ UIN : 3679482 My ally is the Force, and a powerful ally it is. - Yoda ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Writing Custom Functions
As long as we're talking about variable scopes, is there a structure that I can get access to that contains all local variables? That is, variables that are in the variables scope. I have a debug routine at the bottom of all my pages that displays all application,session,form,url,request,cgi variables, and I would LOVE to be able to include local variables as well. Thanks! -- Avi Flax Developer, Afternic.com [EMAIL PROTECTED] 212-798-5484 Art is the lie that makes us realize truth. - Pablo Picasso At 02:27 AM 5/31/2001 -0400, Michael Dinowitz wrote: No scope unless it was directly loaded into something like the request or server scopes. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Writing Custom Functions
I am with ya. I have wanted that for a long time. - Original Message - From: Avi Flax [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, May 31, 2001 8:47 PM Subject: Re: Writing Custom Functions As long as we're talking about variable scopes, is there a structure that I can get access to that contains all local variables? That is, variables that are in the variables scope. I have a debug routine at the bottom of all my pages that displays all application,session,form,url,request,cgi variables, and I would LOVE to be able to include local variables as well. Thanks! -- Avi Flax Developer, Afternic.com [EMAIL PROTECTED] 212-798-5484 Art is the lie that makes us realize truth. - Pablo Picasso At 02:27 AM 5/31/2001 -0400, Michael Dinowitz wrote: No scope unless it was directly loaded into something like the request or server scopes. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Writing Custom Functions
Michael, Maybe I'm reading this wrong, but I have to ask - does this mean that one can, with CF5, set the code of a UDF into a variable, and then execute that UDF just by calling that variable in function syntax, and it automatically gets evaluated and run? Is that all the function keyword does - is create a variable for the function? Does this mean that we could theoretically use any variable as a function? Or am I missing something? -- Avi Flax Developer, Afternic.com [EMAIL PROTECTED] 212-798-5484 Art is the lie that makes us realize truth. - Pablo Picasso At 04:47 PM 5/24/2001 -0400, Michael Dinowitz wrote: * Team Allaire * The normal operation is to have your UDF either on the same page as you need them or in a CFINCLUDE. If your especially evil then you can load them into server or application variables in an initialization page and then use them as server.stringlimit('this is my string', 5). Using them in server or application vars might run into locking problems and I'm investigating this. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Writing Custom Functions
Your reading me correctly. A UDF is a 'system symbol' like any variable, object reference, etc. This means it shows up in an IsDefined() call and even has its own function (IsCustomFunction()). The example below shows a simple UDF and it's aliases. One of which is a server variable. CFSCRIPT function test() { return spam; } coffee=test; tea=coffee; flyme=coffee; server.yes=test; /CFSCRIPT CFOUTPUT #test()#BR #coffee()#BR #tea()#BR #flyme()#BR #server.yes()# /CFOUTPUT Michael, Maybe I'm reading this wrong, but I have to ask - does this mean that one can, with CF5, set the code of a UDF into a variable, and then execute that UDF just by calling that variable in function syntax, and it automatically gets evaluated and run? Is that all the function keyword does - is create a variable for the function? Does this mean that we could theoretically use any variable as a function? Or am I missing something? -- Avi Flax Developer, Afternic.com [EMAIL PROTECTED] 212-798-5484 Art is the lie that makes us realize truth. - Pablo Picasso At 04:47 PM 5/24/2001 -0400, Michael Dinowitz wrote: * Team Allaire * The normal operation is to have your UDF either on the same page as you need them or in a CFINCLUDE. If your especially evil then you can load them into server or application variables in an initialization page and then use them as server.stringlimit('this is my string', 5). Using them in server or application vars might run into locking problems and I'm investigating this. ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Writing Custom Functions
Maybe I'm reading this wrong, but I have to ask - does this mean that one can, with CF5, set the code of a UDF into a variable, and then execute that UDF just by calling that variable in function syntax, and it automatically gets evaluated and run? Yes. Consider this: CFSCRIPT function foo() { return Your mother; } request.foo = foo; /CFSCRIPT You can then do: CFSET X = Request.Foo() or CFOUTPUT#Request.Foo()#/CFOUTPUT Just like 'normal' functions. Is that all the function keyword does - is create a variable for the function? Does this mean that we could theoretically use any variable as a function? You can't declare a function with a dot in the name. That's why I can't do, function request.foo I have to give it a 'normal' name first then copy it. You can also use IsCustomFunction to check if the function has been created. === Raymond Camden, Principal Spectra Compliance Engineer for Macromedia Email : [EMAIL PROTECTED] ICQ UIN : 3679482 My ally is the Force, and a powerful ally it is. - Yoda ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Writing Custom Functions
I havent used CF5 yet but is it true that you are limited to the same tags available for use in cfscript tags? Doesn't this mean no database related functions are not possible? What exactly can you do inside UDFs? Thanks KOla -Original Message- From: Steve Reich [mailto:[EMAIL PROTECTED]] Sent: 25 May 2001 00:57 To: CF-Talk Subject: Re: Writing Custom Functions Sounds good! Who am I to argue with Ben Forta and Micheal Dinowitz!?!? Looking forward to the UDF's at any rate... thanks for the info! Steve ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Writing Custom Functions
* Team Allaire * Yes your limited to CFSCRIPT functionality. Yes, you can use CreateObject to connect to the ADO COM object to do DB calls on windows machines. Yes there's a library called LibADO for this. What you can do in UDF is limited only by your imagination. This is especially true when dealing with COM and object related technology. I havent used CF5 yet but is it true that you are limited to the same tags available for use in cfscript tags? Doesn't this mean no database related functions are not possible? What exactly can you do inside UDFs? Thanks KOla -Original Message- From: Steve Reich [mailto:[EMAIL PROTECTED]] Sent: 25 May 2001 00:57 To: CF-Talk Subject: Re: Writing Custom Functions Sounds good! Who am I to argue with Ben Forta and Micheal Dinowitz!?!? Looking forward to the UDF's at any rate... thanks for the info! Steve ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Writing Custom Functions
I already know the answer to this, but I thought I would see what it might inspire Is it possible to write a custom function? Here is an example of what I would like to be able to do. The following code limits the display of lname to 8 characters cfif len(lname) GT 8#Left(lname, 8)#...cfelse#lname#/cfif What I was wondering is if I could somehow create a function, and then call it like so (this is what I really want to know)... #StringLimit(lname, 8)# Maybe I've been playing around too much with Javascript, but this seems logical. I know I can write a custom tag... !StringLimit.cfm cfparam name=attributes.value default= cfparam name=attributes.limit default=0 cfparam name=attributes.tail default=... cfif len(attributes.value) GT attributes.limit#Left(attributes.value, attributes.limit)##attributes.tail#cfelse#attributes.value#/cfif ! Call it as a tag cf_StringLimit value=#lname# limit=8 tail=... Are there other guru secrets anyone wants to share on this topic? Thanks, Steve ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Writing Custom Functions
* Team Allaire * In CF 5 the answer is yes. CFSCRIPT function StringLimit(string, length) { if (len(string) GT 8) return Left(lname, 8); else return string; } /CFSCRIPT I already know the answer to this, but I thought I would see what it might inspire Is it possible to write a custom function? Here is an example of what I would like to be able to do. The following code limits the display of lname to 8 characters cfif len(lname) GT 8#Left(lname, 8)#...cfelse#lname#/cfif What I was wondering is if I could somehow create a function, and then call it like so (this is what I really want to know)... #StringLimit(lname, 8)# Maybe I've been playing around too much with Javascript, but this seems logical. I know I can write a custom tag... !StringLimit.cfm cfparam name=attributes.value default= cfparam name=attributes.limit default=0 cfparam name=attributes.tail default=... cfif len(attributes.value) GT attributes.limit#Left(attributes.value, attributes.limit)##attributes.tail#cfelse#attributes.value#/cfif ! Call it as a tag cf_StringLimit value=#lname# limit=8 tail=... Are there other guru secrets anyone wants to share on this topic? Thanks, Steve ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Writing Custom Functions
This is possible in ColdFusion 5 which will be released soon. For an set of examples on UDF, see www.cflib.org. === Raymond Camden, Principal Spectra Compliance Engineer for Macromedia Email : [EMAIL PROTECTED] ICQ UIN : 3679482 My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Steve Reich [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 24, 2001 2:48 PM To: CF-Talk Subject: Writing Custom Functions I already know the answer to this, but I thought I would see what it might inspire Is it possible to write a custom function? Here is an example of what I would like to be able to do. The following code limits the display of lname to 8 characters cfif len(lname) GT 8#Left(lname, 8)#...cfelse#lname#/cfif What I was wondering is if I could somehow create a function, and then call it like so (this is what I really want to know)... #StringLimit(lname, 8)# ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Writing Custom Functions
CF 5 will provide this capability. - Original Message - From: Steve Reich [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, May 24, 2001 14:48 Subject: Writing Custom Functions I already know the answer to this, but I thought I would see what it might inspire Is it possible to write a custom function? Here is an example of what I would like to be able to do. The following code limits the display of lname to 8 characters cfif len(lname) GT 8#Left(lname, 8)#...cfelse#lname#/cfif What I was wondering is if I could somehow create a function, and then call it like so (this is what I really want to know)... #StringLimit(lname, 8)# Maybe I've been playing around too much with Javascript, but this seems logical. I know I can write a custom tag... !StringLimit.cfm cfparam name=attributes.value default= cfparam name=attributes.limit default=0 cfparam name=attributes.tail default=... cfif len(attributes.value) GT attributes.limit#Left(attributes.value, attributes.limit)##attributes.tail#cfelse#attributes.value#/cfif ! Call it as a tag cf_StringLimit value=#lname# limit=8 tail=... Are there other guru secrets anyone wants to share on this topic? Thanks, Steve ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Writing Custom Functions
you can write a custom fuction in CF 5.0, just as if u were using javascript or whatever. From: Steve Reich [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Subject: Writing Custom Functions Date: Thu, 24 May 2001 14:48:11 -0400 I already know the answer to this, but I thought I would see what it might inspire Is it possible to write a custom function? Here is an example of what I would like to be able to do. The following code limits the display of lname to 8 characters cfif len(lname) GT 8#Left(lname, 8)#...cfelse#lname#/cfif What I was wondering is if I could somehow create a function, and then call it like so (this is what I really want to know)... #StringLimit(lname, 8)# Maybe I've been playing around too much with Javascript, but this seems logical. I know I can write a custom tag... !StringLimit.cfm cfparam name=attributes.value default= cfparam name=attributes.limit default=0 cfparam name=attributes.tail default=... cfif len(attributes.value) GT attributes.limit#Left(attributes.value, attributes.limit)##attributes.tail#cfelse#attributes.value#/cfif ! Call it as a tag cf_StringLimit value=#lname# limit=8 tail=... Are there other guru secrets anyone wants to share on this topic? Thanks, Steve ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Writing Custom Functions
User-defined functions (UDFs) will be available in ColdFusion 5.0, which should be released in the near future. The syntax will not allow you to call tags from within the custom function, only cfscript elements and functions. For example: cfscript function StringLimit(thestring,length) { if (len(thestring) GT 8) { return left(thestring,8); } else { return thestring } } /cfscript You can then call the function as you wrote below. Again, this functionality is not available in ColdFusion 4.x, but is available in 5.0 -Matt -Original Message- From: Steve Reich [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 24, 2001 2:48 PM To: CF-Talk Subject: Writing Custom Functions I already know the answer to this, but I thought I would see what it might inspire Is it possible to write a custom function? Here is an example of what I would like to be able to do. The following code limits the display of lname to 8 characters cfif len(lname) GT 8#Left(lname, 8)#...cfelse#lname#/cfif What I was wondering is if I could somehow create a function, and then call it like so (this is what I really want to know)... #StringLimit(lname, 8)# Maybe I've been playing around too much with Javascript, but this seems logical. I know I can write a custom tag... !StringLimit.cfm cfparam name=attributes.value default= cfparam name=attributes.limit default=0 cfparam name=attributes.tail default=... cfif len(attributes.value) GT attributes.limit#Left(attributes.value, attributes.limit)##attributes.tail#cfelse#attributes.value#/cfif ! Call it as a tag cf_StringLimit value=#lname# limit=8 tail=... Are there other guru secrets anyone wants to share on this topic? Thanks, Steve ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Writing Custom Functions
Awesome! Thanks Michael...! Will those user defined functions be included in a global functions page or how are they accessed? Say you have 50 user defined functions you wouldn't want to include them all, right? Steve Reich Michael Dinowitz [EMAIL PROTECTED] wrote in message 048001c0e484$90ee3480$[EMAIL PROTECTED]">news:048001c0e484$90ee3480$[EMAIL PROTECTED]... * Team Allaire * In CF 5 the answer is yes. CFSCRIPT function StringLimit(string, length) { if (len(string) GT 8) return Left(lname, 8); else return string; } /CFSCRIPT I already know the answer to this, but I thought I would see what it might inspire Is it possible to write a custom function? Here is an example of what I would like to be able to do. The following code limits the display of lname to 8 characters cfif len(lname) GT 8#Left(lname, 8)#...cfelse#lname#/cfif What I was wondering is if I could somehow create a function, and then call it like so (this is what I really want to know)... #StringLimit(lname, 8)# Maybe I've been playing around too much with Javascript, but this seems logical. I know I can write a custom tag... !StringLimit.cfm cfparam name=attributes.value default= cfparam name=attributes.limit default=0 cfparam name=attributes.tail default=... cfif len(attributes.value) GT attributes.limit#Left(attributes.value, attributes.limit)##attributes.tail#cfelse#attributes.value#/cfif ! Call it as a tag cf_StringLimit value=#lname# limit=8 tail=... Are there other guru secrets anyone wants to share on this topic? Thanks, Steve ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Writing Custom Functions
* Team Allaire * The normal operation is to have your UDF either on the same page as you need them or in a CFINCLUDE. If your especially evil then you can load them into server or application variables in an initialization page and then use them as server.stringlimit('this is my string', 5). Using them in server or application vars might run into locking problems and I'm investigating this. Awesome! Thanks Michael...! Will those user defined functions be included in a global functions page or how are they accessed? Say you have 50 user defined functions you wouldn't want to include them all, right? Steve Reich Michael Dinowitz [EMAIL PROTECTED] wrote in message 048001c0e484$90ee3480$[EMAIL PROTECTED]">news:048001c0e484$90ee3480$[EMAIL PROTECTED]... * Team Allaire * In CF 5 the answer is yes. CFSCRIPT function StringLimit(string, length) { if (len(string) GT 8) return Left(lname, 8); else return string; } /CFSCRIPT I already know the answer to this, but I thought I would see what it might inspire Is it possible to write a custom function? Here is an example of what I would like to be able to do. The following code limits the display of lname to 8 characters cfif len(lname) GT 8#Left(lname, 8)#...cfelse#lname#/cfif What I was wondering is if I could somehow create a function, and then call it like so (this is what I really want to know)... #StringLimit(lname, 8)# Maybe I've been playing around too much with Javascript, but this seems logical. I know I can write a custom tag... !StringLimit.cfm cfparam name=attributes.value default= cfparam name=attributes.limit default=0 cfparam name=attributes.tail default=... cfif len(attributes.value) GT attributes.limit#Left(attributes.value, attributes.limit)##attributes.tail#cfelse#attributes.value#/cfif ! Call it as a tag cf_StringLimit value=#lname# limit=8 tail=... Are there other guru secrets anyone wants to share on this topic? Thanks, Steve ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Writing Custom Functions
Please let us know! This could be really powerful! Russel Madere, Jr. Senior Web Developer ICQ: 5446158 http://www.TurboSquid.com Some days you eat the bear; some days the bear eats you. -Original Message- From: Michael Dinowitz [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 24, 2001 15:48 To: CF-Talk Subject: Re: Writing Custom Functions * Team Allaire * The normal operation is to have your UDF either on the same page as you need them or in a CFINCLUDE. If your especially evil then you can load them into server or application variables in an initialization page and then use them as server.stringlimit('this is my string', 5). Using them in server or application vars might run into locking problems and I'm investigating this. Awesome! Thanks Michael...! Will those user defined functions be included in a global functions page or how are they accessed? Say you have 50 user defined functions you wouldn't want to include them all, right? Steve Reich Michael Dinowitz [EMAIL PROTECTED] wrote in message 048001c0e484$90ee3480$[EMAIL PROTECTED]">news:048001c0e484$90ee3480$[EMAIL PROTECTED]... * Team Allaire * In CF 5 the answer is yes. CFSCRIPT function StringLimit(string, length) { if (len(string) GT 8) return Left(lname, 8); else return string; } /CFSCRIPT I already know the answer to this, but I thought I would see what it might inspire Is it possible to write a custom function? Here is an example of what I would like to be able to do. The following code limits the display of lname to 8 characters cfif len(lname) GT 8#Left(lname, 8)#...cfelse#lname#/cfif What I was wondering is if I could somehow create a function, and then call it like so (this is what I really want to know)... #StringLimit(lname, 8)# Maybe I've been playing around too much with Javascript, but this seems logical. I know I can write a custom tag... !StringLimit.cfm cfparam name=attributes.value default= cfparam name=attributes.limit default=0 cfparam name=attributes.tail default=... cfif len(attributes.value) GT attributes.limit#Left(attributes.value, attributes.limit)##attributes.tail#cfelse#attributes.value#/cfif ! Call it as a tag cf_StringLimit value=#lname# limit=8 tail=... Are there other guru secrets anyone wants to share on this topic? Thanks, Steve ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Writing Custom Functions
The normal operation is to have your UDF either on the same page as you need them or in a CFINCLUDE. If your especially evil then you can load them into server or application variables in an initialization page and then use them as server.stringlimit('this is my string', 5). Using them in server or application vars might run into locking problems and I'm investigating this. What about putting them in a custom tag and then just calling the UDF's you need? You could have all of your UDF's in a single file and call them as you need them cf_UDF GetFunctions=StringLimit, IntegerCount, MyGrandmasFavoriteCookieRecipe, OneMoreFunction That way, you could keep them all in one place and use them in any file on the server. Having to include the code each time you need it sounds like it might suck a little... kinda defeating the purpose? Anyway, looking forward to that functionality thanks for the info! Steve ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Writing Custom Functions
* Team Allaire * Why kill all the cool speed increase you get from a UDF by putting it in a custom tag? A 'header library' is acceptable in most languages so putting CFINCLUDE template=/cfide/library/libdebug.cfm in the application.cfm is good. Putting CFINCLUDE template=/cfide/library/libfile.cfm on the top of your template is also acceptable and probably more so than the custom tag. Just have all the file manipulation UDFs in the include. CFINCLUDE has a whole lot less overhead than custom tags. Once a UDF is defined once, it can be used over and over again on the same page. The reason I suggested putting it in server vars is that you can do this: CFIF Not IsDefined('server.udf') CFINCLUDE template=/cfide/library/libdebug.cfm CFINCLUDE template=/cfide/library/libfile.cfm CFSET server.udf=1 /CFIF This is a small check per page run and it'll only be run once. I'm playing with the server wide locking for server variables to avoid the need for CFLOCK. What about putting them in a custom tag and then just calling the UDF's you need? You could have all of your UDF's in a single file and call them as you need them cf_UDF GetFunctions=StringLimit, IntegerCount, MyGrandmasFavoriteCookieRecipe, OneMoreFunction That way, you could keep them all in one place and use them in any file on the server. Having to include the code each time you need it sounds like it might suck a little... kinda defeating the purpose? Anyway, looking forward to that functionality thanks for the info! Steve ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Writing Custom Functions
You don't want to use tags to use functions - part of the appeal of functions is they don't have the overhead of tags, and are thus much quicker. One solution is to create libraries - CFM files with related functions, a string library, a math library, a formatting library, etc, then just include the ones you want. Kind of like including header file in C. --- Ben -Original Message- From: Steve Reich [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 24, 2001 6:08 PM To: CF-Talk Subject: Re: Writing Custom Functions The normal operation is to have your UDF either on the same page as you need them or in a CFINCLUDE. If your especially evil then you can load them into server or application variables in an initialization page and then use them as server.stringlimit('this is my string', 5). Using them in server or application vars might run into locking problems and I'm investigating this. What about putting them in a custom tag and then just calling the UDF's you need? You could have all of your UDF's in a single file and call them as you need them cf_UDF GetFunctions=StringLimit, IntegerCount, MyGrandmasFavoriteCookieRecipe, OneMoreFunction That way, you could keep them all in one place and use them in any file on the server. Having to include the code each time you need it sounds like it might suck a little... kinda defeating the purpose? Anyway, looking forward to that functionality thanks for the info! Steve ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Writing Custom Functions
What about putting them in a custom tag and then just calling the UDF's you need? You could have all of your UDF's in a single file and call them as you need them cf_UDF GetFunctions=StringLimit, IntegerCount, MyGrandmasFavoriteCookieRecipe, OneMoreFunction That way, you could keep them all in one place and use them in any file on the server. Having to include the code each time you need it sounds like it might suck a little... kinda defeating the purpose? The usual method of using collections of functions is to group related functions into individual libraries. Then you use the language's include directive to include the library file inline into the source code. It's common to be working with a function library and find yourself using additional functions from the library. Using a tag to just include the functions you want, you'd have to keep appending these additional functions. cfinclude template=stringlib.cfm cfinclude template=mathlib.cfm cfinclude template=creditcardlib.cfm If you need to use the function libraries within different web sites on the same server, then a good idea might be a tag to include the necessary libraries. That way they could be kept in a single location. Of course it doesn't help you the next time you develop a site on a different machine. One nice thing about general purpose function libraries is that they can often be written and then need very few modifications in the future. You just try to envision how the function may be used in various situations then optimize and debug the heck out of it, put it in the can, and then forget about it. Jim ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Writing Custom Functions
Sounds good! Who am I to argue with Ben Forta and Micheal Dinowitz!?!? Looking forward to the UDF's at any rate... thanks for the info! Steve ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
CF 5.0 (custom functions)
Visited the beta forum and straight from the horse's mouth: custom function ability is not in beta 1. That kinda killed my anticipation for 5.0 since functions can be a poor man's object oriented approach . So we have heard of query on query. Anything else? It better be worth the wait. If they can get rid of location 26 errors with 5.0 and/or give us access to the cf output buffer then I will be more than happy. =) Xing ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: CF 5.0 (custom functions)
Visited the beta forum and straight from the horse's mouth: custom function ability is not in beta 1. That kinda killed my anticipation for 5.0 since functions can be a poor man's object oriented approach . So we have heard of query on query. Anything else? It better be worth the wait. If they can get rid of location 26 errors with 5.0 and/or give us access to the cf output buffer then I will be more than happy. =) I don't know if lack of user defined functions in the first beta means that they're not planned for CF 5. I agree, however, without this simplest of language features, most everything else is window-dressing. Jim ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Extension to custom functions...
Can anyone think of a way of calling custom tags from within functions or cfscript? I think it's possible using a variation of Michael Dinowitz custom functions. Just set up a page full of custom tags, and set up a function that you pass in various values to and it returns a value. This value is then used in a cfswitch to pull in certain cfcase statements. It's just an idea at the moment, but I think it may work. Anyone see any deliberate mistakes? The only problem I can see (possibly) is how to move from the cfscript/functions to the tag. ... at this point my mind is going a bit into overdrive ... This could be got round by creating a temporary file and sticking cf code in there. The function could then output a variable, which gets written to a file, is cfincluded into the page and then it is cold fusion code ... Maybe I'll try and write something... Paul Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Extension to custom functions...
Sorry. I was having a bit of a mare there! The only thing that you would need for this to happen is a variable that if it was changed within the page could call a function at any point. This cannot happen, because all variables are set at the time of execution (unless you can think of a workaround). Effectively, all you need is to put in a load of code if something changes (maybe you could use error checking to include it with cftry). Paul -Original Message- From: Paul Johnston [mailto:[EMAIL PROTECTED]] Sent: 18 October 2000 12:15 To: CF-Talk Subject: Extension to custom functions... Can anyone think of a way of calling custom tags from within functions or cfscript? I think it's possible using a variation of Michael Dinowitz custom functions. Just set up a page full of custom tags, and set up a function that you pass in various values to and it returns a value. This value is then used in a cfswitch to pull in certain cfcase statements. It's just an idea at the moment, but I think it may work. Anyone see any deliberate mistakes? The only problem I can see (possibly) is how to move from the cfscript/functions to the tag. ... at this point my mind is going a bit into overdrive ... This could be got round by creating a temporary file and sticking cf code in there. The function could then output a variable, which gets written to a file, is cfincluded into the page and then it is cold fusion code ... Maybe I'll try and write something... Paul -- -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
Re: Custom Functions in ColdFusion
Great article! I do have a question about it though, if anyone has had a read through and maybe tried it out... The examples Michael gives use server variables... which in a shared hosting environment I assume could cause problems. Could the same thing be done using application variables? Maybe I'm missing something essential about the way they work... Thanks, Kay. __ Kay Smoljak - HTML/ColdFusion Developer - PerthWeb Pty Ltd Internet Solutions for your business! Level 9/105 St George's Tc - Perth - Western Australia Ph: (08) 9226 1366 Fax: (08) 9226 1375 Mobile : 0419 949 007 Visit Perth online! : www.perthweb.com.au On Fri, 8 Sep 2000 18:59:07 -0400, in cf-talk you wrote: The latest issue of Fusion Authority has been released. In this issue, Michael Dinowitz discusses how to 'hack' ColdFusion to create custom functions. Michael Dinowitz Publisher: Fusion Authority weekly news alert (www.fusionauthority.com/alert) Listmaster: CF-Talk, CF-Jobs, Spectra-Talk, Jrun-Talk, etc. (www.houseoffusion.com) -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebarRstsbodyRsts/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: Custom Functions in ColdFusion
Application variables must be locked just as much as Server variables. At 07:57 PM 9/10/00 +0800, Kay Smoljak wrote: Great article! I do have a question about it though, if anyone has had a read through and maybe tried it out... The examples Michael gives use server variables... which in a shared hosting environment I assume could cause problems. Could the same thing be done using application variables? Maybe I'm missing something essential about the way they work... Thanks, Kay. __ Kay Smoljak - HTML/ColdFusion Developer - PerthWeb Pty Ltd Internet Solutions for your business! Level 9/105 St George's Tc - Perth - Western Australia Ph: (08) 9226 1366 Fax: (08) 9226 1375 Mobile : 0419 949 007 Visit Perth online! : www.perthweb.com.au On Fri, 8 Sep 2000 18:59:07 -0400, in cf-talk you wrote: The latest issue of Fusion Authority has been released. In this issue, Michael Dinowitz discusses how to 'hack' ColdFusion to create custom functions. Michael Dinowitz Publisher: Fusion Authority weekly news alert (www.fusionauthority.com/alert) Listmaster: CF-Talk, CF-Jobs, Spectra-Talk, Jrun-Talk, etc. (www.houseoffusion.com) -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebarstsbodysts/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. --- Peter Theobald, Chief Technology Officer LiquidStreaming http://www.liquidstreaming.com [EMAIL PROTECTED] Phone 1.212.545.1232 Fax 1.212.679.8032 -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: Custom Functions in ColdFusion
Great article! I do have a question about it though, if anyone has had a read through and maybe tried it out... Thanks. :) The examples Michael gives use server variables... which in a shared hosting environment I assume could cause problems. Could the same thing be done using application variables? Maybe I'm missing something essential about the way they work... I used server variables so that you could have the functions in memory at all times to be used. Server variables are in memory across all applications on a single machine. Application variables are stored in memory the same way but are limited to a single application. You could change it to use application vars, but would still need locking (at least for the setting). Truth be told, they could be set as standard variables and not have a prefix at all, but then they have to be set on any page that needs them. In my next article, I'll be going over advanced custom functions as well as provide a script to include them into your application easily. Michael Dinowitz Publisher: Fusion Authority weekly news alert (www.fusionauthority.com/alert) Listmaster: CF-Talk, CF-Jobs, Spectra-Talk, Jrun-Talk, etc. (www.houseoffusion.com) -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: Custom Functions in ColdFusion
On Sun, 10 Sep 2000 13:03:27 -0400, in cf-talk Michael Dinowitz wrote: You could change it to use application vars, but would still need locking (at least for the setting). That was what I was thinking... I was less concerned about locking and more concerned about other users setting server vars with the same name or something in a shared hosting environment. In my next article, I'll be going over advanced custom functions as well as provide a script to include them into your application easily. Cool! Can't wait... K. __ Kay Smoljak - HTML/ColdFusion Developer - PerthWeb Pty Ltd Internet Solutions for your business! Level 9/105 St George's Tc - Perth - Western Australia Ph: (08) 9226 1366 Fax: (08) 9226 1375 Mobile : 0419 949 007 Visit Perth online! : www.perthweb.com.au -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
custom functions
Was the article on custom functions ever published on FusionAuthority? If so where is it? I can't seem to find it. Then again I can't open a bag of cookies without scissor's but that's something else entirely. --K Thank you, Katrina Chapman ColdFusion Web Developer Systems Development -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.