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/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists