Replacing a custom tag that uses GeneratedContent with a plugin

Hi,

I an fishing for thoughts on how, if possible, I could convert a
customTag that relies on the GeneratedContent funcationality into a
plugin.

The primary impetus is to move the customTag to something more easily
controlled by the framework. This maybe a false ideal so any feedback
would be great.

thanks
Kevin Marino

I've actually just been through this process for a couple of my tags.
What we ended up doing was just using a setter for the value of what
used to be generated content

<cf_myTag attrib1="foo" attrib2="bar">
    generatedcontent
</cf_myTag>

becomes

getPlugin("myPlugin").execute(attrib1="foo", attrib2="bar",
generatedContent="generatedContent");

That's nice and easy if you don't have any child tags that rely on the
parent's attributes to execute. The tag code itself is easy to migrate
- just replace "attributes" with "arguments" and you're basically done
(subject to applying VAR to all the variables of course)

For stuff that had child tags we did something like this:

<cf_myTag attrib1="foo" attrib2="bar">
   <cf_myChildTag attrib1="a" attrib2="b"/>
    ....
</cf_myTag>

it becomes:

var params = {
    attrib1="foo",
   attrib2="bar",
    generatedContent="generatedContent",
    children=[
          {type="myChildTag", attrib1="a", attrib2="b"}
    ]
};

getPlugin("myPlugin").execute(params);

the "children" array could also be an array of proper objects if you
choose.

Having said that, when all was said and done I ended up sticking with
the tag markup because it was a bit more concise, but changed the tag
to use the execute method of the new object (rather than performing
its own logic) so that it can be used from <cfscript> where necessary.