Entries Tagged as FW/1

Using the FW/1 BuildURL helper method inside Custom Tags

At some point when working on my delicious replacement project, I decided to write a custom tag to encapsulate some repetitive view code. The problem I ran into, however, is that the buildUrl() helper method for views is not available in custom tags (sort of by design, custom tags are pretty sandboxed).

There is a thread on the FW/1 mailing list for this very problem, but I wasn't satisfied with the last solution offered (7/28/2010):

<cf_myTag fw="#this#" />

First of all, it's kind of ugly. Second, I don't want to have to (a) remember to type all of that extra code, or (b) type all of that extra code, just to use a custom tag that outputs URLs.

After a few minutes of thinking, I came up with this line, which I added near the top of my custom tag:

<cfset variables.fw = caller.this />

This accomplishes the same thing as the previous example, but I only have to write the code once (in the custom tag) and never have to think about it again.

Ahhhhh... that's better.

I've tested this on Adobe CF 9.01, and Todd Rafferty tells me that it also works on Railo.

in FW/1 | 2 Responses Posted 2010-12-23 07:50