Tag to cease processing the current template

Similar to the way <cfbreak> exits out of a loop, should/could there be a way to exit the current template without aborting the whole request?

Something along the lines of:

<cfif conditional>
    <cfinclude template="someOtherTemplate.cfm" />
    <cftemplatebreak /><!--- the best i could come up with in 5 seconds.  --->
</cfif>

<!--- rest of the template here... --->

like <cfexit method=ā€œExitTemplateā€> ?

+1 for using an existing tag. I wince slightly at the attribute name/value, but given that it follows the existing convention is enough for me to give it a pass.

Perhaps on the .lucee side, it could look more like:

<:exit customtag />
<:exit template />

and optionally be able to parametize the attributes to specify which tag/template to exit:

<:exit template="/path/to/template.(lucee|cfm)" />

similar to the way you can pass a loop tag to break/continue.

@dajester2013 - I think you have misunderstood with @21Solutions was saying, he is saying it already exists.

1 Like

My bad, I missed that - there needs to be some line breaks in that box with the attribute values :wink:

youā€™re right, we need to fix that.

but it existed in CF for years so many of the ā€œoldā€ developers are familiar with it.

Donā€™t forget you can fix these things yerself!

Iā€™ve done so, and thereā€™s a pull req waiting: https://github.com/lucee/lucee-docs/pull/4

ā€“
Adam

1 Like

Muahaha, beat you to it :wink:

1 Like