RE: Calling renderview from inside a custom tag

As long as you don’t really mind breaking the encapsulation of the scopes inside of a custom tag, just do this at the top:

<cfset structAppend(variables,caller)>

Now every variable from the caller scope (including all your ColdBox stuff like event, rc, controller, getPlugin(), etc) is magically available in your local variables scope.

Alternatively, you can pull out the stuff you want:

This is one of the reason custom tags have always felt kind of dirty in ColdBox for me. The only way to get access to all the stuff you’re used to just laying around in variables is pass them all in (dillutes the API) or to have the custom tag get them all from caller (requires tag to have intimate knowledge of the context it’s being called from plus really gets hairy if you start nesting custom tag calls. Then the first tag call either has to pass along everything needed for the inner-most tag, or the innermost tag has to start doing caller.caller.caller.foo stuff.

It should totally be possible though as long as you don’t mind the code smell. :slight_smile:

Thanks!

~Brad

Since these custom tags are only used in the layout files to make things easier for designers, I don’t think that breaking encapsulation is really an issue.

Thank you!

So what do these tags actually do?