Using resource bundles with a custom tag.

I am using cfimport to create a tag lib, then have the following in the custom tag.

#caller.getResource(Attributes.code)#

The error returned is an undefined controller, I am assuming because the customtags do it differently.

Anyway, is there a fix for this? Or even a way to do this in a customtag?

Andrew,

getResource() is a reserved method (resource bundle). See
http://ortus.svnrepository.com/coldbox/trac.cgi/wiki/cbReservedGuide

Or do you want to use the resource bundle?

Ernst

Talking about getting the resource bundle, it works outside of the custom
tag. Just not from with in it.

The only way I get it to work is:

In custom tag:

<cfset variables.controller = caller.controller>
<cfoutput>
   #caller.getResource('general.pageTitle')#
</cfoutput>

BUT wait until Luis is awake.....maybe it's NOT the right way to go.

Ernst

Ok, For some reason, when calling via the caller scope via imported tags, this goes way cookoo!!

The only solution I can see is do direct path to the call: getResource() is a facade in the super type, the full call is

caller.controller.getPlugin(“resourceBundle”).getResource()

Either do that or scope the controller in your tag

variables.controller = caller.controller

This is how CF handles the tags. Therefore, this is a workaround.

Luis

Cheers,

I thought about that, but wasn’t 100% sure that there might be an easier or better way.