includeUdf error message

Hi there

I am trying to user helper udfs to clean up my code, but I am
recieving an error message and am unsure why..

I have created a file called artistHelper which contains a function
called buildImageArtist..

I am trying to use this function in my view artist.cfm, like this

<cfoutput query="rc.qryArtist">
   <img src="#buildImageArtist(idArt)#"/>
   </cfoutput>

I am initally getting an error message saying that Variable
BUILDIMAGEARTIST is undefined.

I have tried moving the artistHelper to a folder called helpers and
appending the following text to my view artist.cfm

<!---Include Helper--->
<cfset includeUDF('helpers/relatedHelper')>

But then I recieve the message

Error loading UDFLibraryFile. The UDF library was not found in your
application's include directory or in the location you specified:

Confused to what I am doing wrong

Thanks

1). Where did you put the artistHelper.cfm.. when you got the
BuildImageArtist error? It should be located in the views folder right
next to the artist.cfm
/views
   /artist.cfm
   /artistHelper.cfm

2) the relatedHelper.cfm your trying to IncludeUDF() should probably be
located in the /includes/helpers folder by convention I believe...

/includes
    /helpers
     
3) Or you could use this config in the xml to always load up this UDFLibrary
<!--UDF Library To Load on every request for your views and handlers -->
        <Setting name="UDFLibraryFile"
value="/path/to/your/helper.cfm" />

-Adam

namtax wrote:

Thanks for response..

1)Yes the artistHelper is located in the views folder right next to
artist.cfm, but when I try and use the buildImageArtist function from
the artistHelper.cfm in my artist.cfm, like so

<cfoutput query="rc.qryArtist">
   <img src="#buildImageArtist(idArt)#"/>
   </cfoutput>

I still get the error message...

2) I have created a folder called helpers within my includes folder,
and moved the artistHelper.cfm to there...

Then in my view artist.cfm, I have tried the following text

<cfset includeUDF('includes/helpers/artistHelper')>

or

<cfset includeUDF('helpers/artistHelper')>

And they both bring up the error message...Error loading
UDFLibraryFile. The UDF library was not found in your application's
include directory or in the location you specified:

3) This one works....YIPEEEE!!! Ha ha ha

Thanks...ha ha

No prob..

FYI.. you needed the '.cfm' on IncludeUDF()

http://ortus.svnrepository.com/coldbox/trac.cgi/wiki/cbLayoutsViewsGuide#HelperUDFs

namtax wrote:

Ok, thats where I was going wrong..

I prefer method 3 anyway....thats the easiest I reckon.

Thanks