Created
May 3, 2021 11:25
-
-
Save bennadel/91180ba7ba254b23dc5680f8b0db915b to your computer and use it in GitHub Desktop.
Setting Global, Default Tag Attributes With "this.tag" In Lucee CFML 5.3.7.47
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component | |
output = false | |
hint = "I define the application settings and event-handlers." | |
{ | |
this.name = "TestingGlobalTagAttributes"; | |
this.applicationTimeout = createTimeSpan( 0, 0, 10, 0 ); | |
this.sessionManagement = false; | |
this.tag = {}; | |
// Randomly select one style of global tag attribute assignment (50/50 chance). | |
if ( randRange( 0, 1 ) ) { | |
this.tag.dump = { | |
label: "Set Using DUMP", | |
var: "Set using DUMP", | |
format: "text", | |
abort: false | |
}; | |
} else { | |
this.tag.cfdump = { | |
label: "Set Using CFDUMP", | |
var: "Set using CFDUMP", | |
format: "simple", | |
abort: true | |
}; | |
} | |
/** | |
* I process the incoming request. | |
*/ | |
public void function onRequest() { | |
render( "<cfdump>" ); | |
render( "This should not render if ABORT was default." ); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component | |
output = false | |
hint = "I define the application settings and event-handlers." | |
{ | |
this.name = "TestingGlobalTagAttributes2"; | |
this.applicationTimeout = createTimeSpan( 0, 0, 10, 0 ); | |
this.sessionManagement = false; | |
this.tag = {}; | |
// Randomly select one style of global tag attribute assignment (50/50 chance). | |
if ( randRange( 0, 1 ) ) { | |
this.tag.document = { | |
format: "pdf", | |
pagetype: "custom", | |
pagewidth: "3", | |
pageheight: "1", | |
margin: { | |
top: 0, | |
right: 0, | |
bottom: 0, | |
left: 0 | |
} | |
}; | |
} else { | |
this.tag.cfdocument = { | |
format: "pdf", | |
pagetype: "custom", | |
pagewidth: "6", | |
pageheight: "2" | |
}; | |
} | |
/** | |
* I process the incoming request. | |
*/ | |
public void function onRequest() { | |
document { | |
echo( "This is my PDF!" ); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment