I know commandbox will allow you to `execute page....
# box-products
r
I know commandbox will allow you to
execute page.cfm
Is there a way to pass parameters to the page you are executing?
It wasn’t noted in the documentation and when I try passing params commandbox give me fits
d
execute ?
shows you how
r
Touchè, salesman
Thanks Daniel
I am trying to complicate things, as usual
d
no problem. it happens.
b
@Robert Zehnder FWIW, I don't recommend anyone use the
execute
command. It's been superseded by Task Runners, which are far more powerful.
r
There a link for the documentation Brad?
Task runners are nearly identical in design to custom commands you build into a module
They even extend the basecommand CFC
The only real difference is they extend an intermedate baseTask CFC which slightly modifies the
resolvePath()
default behavior and they are meant to be portable on disk and invoked via
task run
.
They also have a bunch of lifecycle methods like before/after/onFail/onCancel, etc
r
I am working on a SSG using commandbox using
exec
to render html pages
b
I would just use cfinclude then, lol
inside of a cfcontent
That's what I've done when I need to generate HTML files from a template in the CLI
r
that is close to where i am
b
The
execute
command is really just a basic wrapper around
cfinclude
for CLI use. if you're putting this inside of a custom command, there's really no benefit IMO just using cfinclude yourself.
r
I will look and see how you handle it. The main thing is passing along my
prc
payload to the page
b
You'd just need to set those variables prior to cfincluding the file
👍 1
The only real drawback is you have to deal with the fact that the CFC you run the cfinclude from will share the same
variables
scope as the .cfm
r
Sweet, thank you brad
b
which can be an issue if the .cfm is doing
<fset variables.importantVariable="randomThing">
The ColdBox renderer uses a special custom tag for rendering .cfm files to help put them in their own protective bubble
r
In this case the page is just simple cfoutput stuff
b
Or you can just have a custom CFC instance you create to encapsulate the rendering where any methods in there are prefixed to avoid overlaps and you re-create a fresh instance every time
r
I will give it a shot
Thanks again for your time, Brad
👍 1
Generating the html with
savecontent
is working like a champ and is so much easer
👍 1