Skip to content

Instantly share code, notes, and snippets.

@bennadel
Created May 3, 2021 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bennadel/91180ba7ba254b23dc5680f8b0db915b to your computer and use it in GitHub Desktop.
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
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." );
}
}
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