tag:help-archives.hannonhill.com,2010-02-09:/discussions/how-do-i/14568-how-would-i-modify-a-template-for-serverside-languageCascade CMS: Discussion 2018-10-18T20:37:21Ztag:help-archives.hannonhill.com,2010-02-09:Comment/350353442014-10-22T16:14:16Z2014-10-22T16:14:16ZHow would I modify a template for serverside language?<div><p>I am working on building a new website in Cascade, I am very
new. The current website (not in Cascade) has a few ColdFusion
based pages (server side language, like PHP).</p>
<p>I would like to be able to make an XML block to allow for simple
variable entry (a number). On load, I will need to feed this
variable to Cold Fusion, based on that variable, certain content
will load.</p>
<p>So do I just need to modify my current template, change the
output, and make a little block for text entry? If so, how might I
go about that?</p></div>Christag:help-archives.hannonhill.com,2010-02-09:Comment/350353442014-10-22T17:56:47Z2014-10-22T17:56:48ZHow would I modify a template for serverside language?<div><p>I am thinking I do not need another template, but rather a new
Configuration Set. I copied the current one and change the output
to ".cfm" (ColdFusion).</p>
<p>So now I need a block to allow users to enter the variable. How
would I get my ColdFusion in there though?!?!?</p></div>Christag:help-archives.hannonhill.com,2010-02-09:Comment/350353442014-10-22T18:12:24Z2014-10-22T18:12:25ZHow would I modify a template for serverside language?<div><p>[can someone please move this post to the appropriate
category?]</p></div>Christag:help-archives.hannonhill.com,2010-02-09:Comment/350353442014-10-22T18:50:03Z2014-10-22T18:50:03ZHow would I modify a template for serverside language?<div><p>Hi Chris,</p>
<p>It sounds like you are on the right track here. As you
mentioned, you would need to add an Output to your Configuration
Set so the page is published as a <code>.cfm</code> file on your
web server. Then, you need to decide a) how you want to allow your
users to input the data, and b) how you want to generate the Cold
Fusion code.</p>
<p>In the simplest use case, you can simply allow your users to
edit the Cold Fusion code (and the data) within an XML Block and
you would include that Block within a region in your Template. The
code itself would be surrounded by <a href=
"http://www.hannonhill.com/kb/Code-Sections/#passthrough-code-section-tags">
#passthrough code sections</a> so Cascade does not attempt to
validate and render the content when viewing the page. If the code
needs to be added to the very top of the published page, you would
use <code>#passthrough-top</code>.</p>
<p>If you would like to go with a more structured approach, you
would create a Data Definition with the desired fields for your
users to fill out and then use a Format in conjunction with a
<a href=
"http://help.hannonhill.com/kb/frequently-asked-questions/create-a-calling-page-index-block">
calling page index block</a> (or the Velocity Locator Tool) to
access that structured data and render the Cold Fusion code
dynamically within your Format. Again, the code would need to be
surrounded by code sections.</p>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/350353442014-10-23T15:21:07Z2014-10-23T15:21:07ZHow would I modify a template for serverside language?<div><p>I think I have everything set correctly, but I am having trouble
actually using my variable:</p>
<pre>
<code>#set ( $page = $_XPathTool.selectSingleNode($contentRoot, "/system-index-block/calling-page/system-page") )
#set ( $id = $page.getChild("system-data-structure").getChild("formID") )
<!--#protect-top
<cfoutput>#ucase("hello world:
#protect-top-->
$_SerializerTool.serialize($id,true)
<!--#protect-top
")#</cfoutput>
#protect-top--></code>
</pre>
<p>The above outputs: <em>HELLO
WORLD:$_SerializerTool.serialize($id,true)</em></p>
<p>Which is not helpful! How do I wrap this variable in
ColdFusion?</p></div>Christag:help-archives.hannonhill.com,2010-02-09:Comment/350353442014-10-23T17:48:52Z2014-10-23T17:48:52ZHow would I modify a template for serverside language?<div><p>Hi Chris,</p>
<p>You are very close. What type of field is <code>formID</code>?
If it is a text field you can simply do the following:</p>
<pre>
<code><!--#protect-top
<cfoutput>#ucase("hello world: ${id.value}")#</cfoutput>
#protect-top--></code>
</pre>
<p>If it is a WYSIWYG field, you would use:</p>
<pre>
<code><!--#protect-top
<cfoutput>#ucase("hello world: ${_SerializerTool.serialize($id, true)}")#</cfoutput>
#protect-top--></code>
</pre>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/350353442014-10-23T18:54:35Z2014-10-23T18:54:35ZHow would I modify a template for serverside language?<div><p>"formID" is a text field.</p>
<pre>
<code>
#set ( $page = $_XPathTool.selectSingleNode($contentRoot, "/system-index-block/calling-page/system-page") )
#set ( $id = $page.getChild("system-data-structure").getChild("formID") )
<!--#protect-top
<cfoutput>#ucase("hello world: ${id.value}")#</cfoutput>
#protect-top--></code>
</pre>
<p>The above outputs: <em>HELLO WORLD: ${ID.VALUE}</em></p>
<p>I must be doing something really wrong. :)</p></div>Christag:help-archives.hannonhill.com,2010-02-09:Comment/350353442014-10-23T19:47:15Z2014-10-23T19:47:15ZHow would I modify a template for serverside language?<div><p>Hm, sounds like the there is either an issue with the way
<code>$id</code> is being set or you may not be including a
<a href="http://help.hannonhill.com/kb/frequently-asked-questions/create-a-calling-page-index-block">
calling page index block</a> in the page region. Either of these
issues would cause the literal text of <code>${id.value}</code> to
be outputted by the Format as opposed to the actual text field
value.</p>
<p>When you have a moment, confirm if you have an index block added
to the region and that you are referencing the field correctly (ie
the field's identifier is indeed <code>formID</code>).</p>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/350353442014-10-23T19:53:21Z2014-10-23T19:53:21ZHow would I modify a template for serverside language?<div><p>Belay that, I got it working!!! :D</p>
<p>My poor ColdFusion skills goofed me up! I can't wait to switch
all of this stuff out with PHP!</p>
<p>Thank you so much for your help Mr. Griffith!</p></div>Chris