root / framework / trunk / extensions / lexicon / cf / savecontent.cfm

Revision 530, 1.0 kB (checked in by scorfield, 1 year ago)

Fixes #247 by adding Barney's cf:savecontent lexicon.

Line 
1<cfscript>
2        // example custom verb that compiles to a <cfsavecontent> tag
3        //
4        // author: Barney Boisvert
5        //
6        // usage:
7        // 1. add the lexicon declaration to your circuit file:
8        //    <circuit xmlns:cf="cf/">
9        // 2. use the verb in a fuseaction:
10        //    <cf:savecontent variable="bodyContent">
11        //        ... other code ...
12        //    </cf:cfsavecontent>
13        if (fb_.verbInfo.executionMode is "start") {
14                if (structKeyExists(fb_.verbInfo.attributes,"variable")) {
15                        fb_.variable = fb_.verbInfo.attributes.variable;
16                } else if (structKeyExists(fb_.verbInfo.attributes,"var")) {
17                        fb_.variable = fb_.verbInfo.attributes.var;
18                } else {
19                        fb_throw(
20                                "fusebox.badGrammar.requiredAttributeMissing",
21                                "Required attribute is missing",
22                                "The attribute 'variable' (or the 'var' shorthand) is required, for a 'savecontent' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."
23                        );
24                }
25                fb_appendLine('<' & 'cfsavecontent variable="#fb_.variable#">');
26        } else {
27                fb_appendLine('<' & '/cfsavecontent>');
28        }
29</cfscript>
Note: See TracBrowser for help on using the browser.