Ticket #247 (closed enhancement: fixed)

Opened 1 year ago

Last modified 1 year ago

PATCH: cf:savecontent verb implementation

Reported by: barneyb Owned by: sean@…
Type: enhancement Priority: normal
Milestone: Fusebox 5.5 Component: Extensions: Lexicons/Plugins
Version: Severity: normal
Keywords: Cc:

Description

Here's a cf:savecontent implementation. First thought is "we don't need that", but it's useful in certain cases (especially during prototyping) where you need to grab the output of something aside from an include or do.

<cfscript>
	// example custom verb that compiles to a <cfsavecontent> tag
	// usage:
	// 1. add the lexicon declaration to your circuit file:
	//    <circuit xmlns:cf="cf/">
	// 2. use the verb in a fuseaction:
	//    <cf:savecontent variable="bodyContent">
	//        ... other code ...
	//    </cf:cfsavecontent>
	if (fb_.verbInfo.executionMode is "start") {
		if (structKeyExists(fb_.verbInfo.attributes,"variable")) {
			fb_.variable = fb_.verbInfo.attributes.variable;
		} else if (structKeyExists(fb_.verbInfo.attributes,"var")) {
			fb_.variable = fb_.verbInfo.attributes.var;
		} else {
			fb_throw(
				"fusebox.badGrammar.requiredAttributeMissing",
				"Required attribute is missing",
				"The attribute 'variable' (or the 'var' shorthand) is required, for a 'savecontent' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."
			);
		}
		fb_appendLine('<' & 'cfsavecontent variable="#fb_.variable#">');
	} else {
		fb_appendLine('<' & '/cfsavecontent>');
	}
</cfscript>

Attachments

Change History

Changed 1 year ago by scorfield

  • milestone set to Fusebox 5.5

Changed 1 year ago by scorfield

  • status changed from new to closed
  • resolution set to fixed

(In [530]) Fixes #247 by adding Barney's cf:savecontent lexicon.

Note: See TracTickets for help on using tickets.