[{"data":1,"prerenderedAt":242},["ShallowReactive",2],{"post:hello-world-cf":3},{"id":4,"title":5,"body":6,"date":227,"description":228,"draft":229,"extension":230,"meta":231,"navigation":232,"path":233,"seo":234,"stem":235,"tags":236,"__hash__":241},"posts\u002Fposts\u002Fhello-world-cf.md","Five Reasons to Learn CF in 2019",{"type":7,"value":8,"toc":222},"minimark",[9,21,26,44,48,51,76,117,124,133,151,160,163,167,181,197,200,203,209,218],[10,11,12,13,20],"p",{},"Now that you've read my ",[14,15,19],"a",{"href":16,"rel":17},"https:\u002F\u002Fdev.to\u002Fmikeborn\u002Fwhy-cf-3jal",[18],"nofollow","Why Coldfusion?"," post (you HAVE, right?), let's do a simple Hello World just to try some sample CF code.",[22,23,25],"h2",{"id":24},"installing-commandbox","Installing Commandbox",[10,27,28,29,34,35,39,40,43],{},"Installing Coldfusion is as easy as downloading ",[14,30,33],{"href":31,"rel":32},"https:\u002F\u002Fwww.ortussolutions.com\u002Fproducts\u002Fcommandbox#download",[18],"Commandbox"," and dropping it in a folder. On Linux, you'll want to drop it in a folder somewhere in your ",[36,37,38],"code",{},"$PATH"," - perhaps ",[36,41,42],{},"\u002Fusr\u002Fbin","? Otherwise (Windows or Mac) just drop it in a folder and drag the box executable to your taskbar to give yourself a nice quick launcher icon.",[22,45,47],{"id":46},"hello-world","Hello World",[10,49,50],{},"Let's do a quick Hello World so we know what we're up against.",[52,53,54,67,73],"ol",{},[55,56,57,58,61,62,66],"li",{},"Create a ",[36,59,60],{},"hello.cfm"," file. Somewhere. (",[63,64,65],"em",{},"Anywhere!",")",[55,68,69,70,72],{},"Edit that ",[36,71,60],{},".",[55,74,75],{},"Type in the following code:",[77,78,83],"pre",{"className":79,"code":80,"language":81,"meta":82,"style":82},"language-html shiki shiki-themes github-light github-dark","\u003Ccfscript>\n    writeOutput( 'Hello, World!' );\n\u003C\u002Fcfscript>\n","html","",[36,84,85,101,107],{"__ignoreMap":82},[86,87,90,94,98],"span",{"class":88,"line":89},"line",1,[86,91,93],{"class":92},"sVt8B","\u003C",[86,95,97],{"class":96},"s7hpK","cfscript",[86,99,100],{"class":92},">\n",[86,102,104],{"class":88,"line":103},2,[86,105,106],{"class":92},"    writeOutput( 'Hello, World!' );\n",[86,108,110,113,115],{"class":88,"line":109},3,[86,111,112],{"class":92},"\u003C\u002F",[86,114,97],{"class":96},[86,116,100],{"class":92},[10,118,119,120,123],{},"Ok, so this is the gist of a modern Coldfusion markup (",[36,121,122],{},".cfm",") file. This file is doing two things:",[52,125,126],{},[55,127,128,129,132],{},"Using ",[36,130,131],{},"\u003Ccfscript>\u003C\u002Fcfscript>"," to denote the Coldfusion script syntax",[10,134,135,136,139,140,143,144,146,147,150],{},"This is just CF's version of PHP's ",[36,137,138],{},"\u003C?php ... ?>"," delimiters. Now, there is a fully-supported, fully-capable tag syntax, but I prefer the script syntax for pretty much everything but templating. I think on the whole, modern CF apps are better off using CFscript syntax - but that's just my opinion. Oh, and you only need this ",[36,141,142],{},"\u003Ccfscript>"," tag in ",[36,145,122],{}," files - anything in a component (a ",[36,148,149],{},".cfc"," file)can launch right into script syntax.",[52,152,153],{},[55,154,155,156,159],{},"Using the ",[36,157,158],{},"writeOutput()"," function to print a string value to the buffer",[10,161,162],{},"This is hopefully straightforward - we're writing output to the buffer. In this example, we're going to use CommandBox to run the file, so the output will be returned inline to the CommandBox CLI.",[22,164,166],{"id":165},"executing-a-cfm-file-in-commandbox","Executing a CFM File in CommandBox",[10,168,169,170,172,173,176,177,180],{},"Here's how we run our ",[36,171,60],{}," file using CommandBox. First, you'll need to start Commandbox by clicking on the launcher or typing ",[36,174,175],{},"box"," in your Mac\u002FLinux terminal. Once in CommandBox, we'll use the ",[36,178,179],{},"execute"," command to run the script and return the output:",[77,182,186],{"className":183,"code":184,"language":185,"meta":82,"style":82},"language-bash shiki shiki-themes github-light github-dark","execute hello.cfm\n","bash",[36,187,188],{"__ignoreMap":82},[86,189,190,193],{"class":88,"line":89},[86,191,179],{"class":192},"sScJk",[86,194,196],{"class":195},"sZZnC"," hello.cfm\n",[10,198,199],{},"Boom! It's that easy to try Coldfusion*. There's no compiling, no building, and no downloading hundreds (or thousands) of dependencies - just run the script.",[10,201,202],{},"If you want to see exactly what that looks like, here you go.",[10,204,205],{},[206,207],"img",{"alt":82,"src":208},"https:\u002F\u002Fthepracticaldev.s3.amazonaws.com\u002Fi\u002F2zm6zixvxryjkxn9rai6.png",[10,210,211],{},[63,212,213,214,217],{},"*Please note that this is not a production-ready format - for that you'd want to run ",[36,215,216],{},"server start engine=lucee@5.2"," to install and start the open-source Lucee server. Let me know if you'd like to see a tutorial about that as well - I'm happy to help you get started!",[219,220,221],"style",{},"html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .s7hpK, html code.shiki .s7hpK{--shiki-default:#B31D28;--shiki-default-font-style:italic;--shiki-dark:#FDAEB7;--shiki-dark-font-style:italic}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}",{"title":82,"searchDepth":103,"depth":103,"links":223},[224,225,226],{"id":24,"depth":103,"text":25},{"id":46,"depth":103,"text":47},{"id":165,"depth":103,"text":166},"2019-03-28T16:13:57-04:00","Now that you've read my Why Coldfusion? post (you HAVE, right?), let's do a simple Hello World just to try some sample CF code.",false,"md",{},true,"\u002Fposts\u002Fhello-world-cf",{"title":5,"description":228},"posts\u002Fhello-world-cf",[237,238,239,240],"coldfusion","cfml","beginners","commandbox","nLTnWEQVymgK68mjceuihQ4r-xE7Fj_AuVSdEJZI0L0",1790471527948]