ColdFusion Variable Inside a Template

4 posts, 1 answers
  1. Ashleigh L
    Ashleigh L avatar
    113 posts
    Member since:
    Jun 2012

    Posted 27 Apr 2015 Link to this post

    I'm implementing Kendo on a site that uses ColdFusion as our server-side language. I'm setting up a template and I have situation where I must​ use a ColdFusion variable inside the template. For those not familiar w/ ColdFusion, it uses the # to indicate ColdFusion markup - ie. if I wanted the content of a div to be populated from a CF variable, I'd have something like:


    In fact, the example above is pretty much exactly what I'm trying to do, just inside a template:

    <script type="text/x-kendo-template" id="tile_template">
        <div class="padding list-items-footer k-block">
            <button type="button" class="btn btn-success">
                <i class="fa-icon-play"></i> <span class="hidden-xs">##APPLICATION.LC.getValue("LaunchButton")##</span>

    APPLICATION.LC is our system for multi-lingual text/labels, which is why it's a requirement.

     I initially only had single # on each side of the CF variable, but that gave me a javascript error. Adding the second # to each side (which is how you escape the # in CF), stopped the error, but what's actually being rendered in the button is 'APPLICATION.LC.get value("LaunchButton")', instead of the CF-calculated value. Additionally, trying to escape the hashes using \, as suggested in the template help, (ie.\#APPLICATION.LC.getValue("LaunchButton")\#), also doesn't cause a javascript error, but again, only outputs '#APPLICATION.LC.get value("LaunchButton")#'.

    I was able to find this thread ( where it was suggested that the selector could be changed for the Kendo templating system, but no further information was provided on how.

    For ease of updating in the future, I'd prefer if we didn't have to change the selector, but I realize it may be inevitable. Any suggestions/guidance that can be provided would be appreciated.

  2. Vladimir Iliev
    Vladimir Iliev avatar
    2206 posts

    Posted 29 Apr 2015 Link to this post

    Hello Shimmoril,

    Could you please share the server output from your initial try (with single "#" symbols) as from the provided information it seems that the code is not evaluated on the server side? Also could you please make sure that your are not missing some additional syntax in order the wrapped code is evaluated?

    <span class="hidden-xs">#APPLICATION.LC.getValue("LaunchButton")#</span>

    Vladimir Iliev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Answer
    Cristiano avatar
    13 posts
    Member since:
    Nov 2012

    Posted 30 Apr 2015 in reply to Ashleigh L Link to this post

    Hello Shimmoril,
    there is two possible solutions:

    1) if you want render a simply ColdFusion variables, use this syntax
    ----- premise 1 -----
    <cfset a = "click here">
    <span class="hidden-xs">#a#</span>

    2) if you want render a Kendo variable and the name of variables is on a ColdFusion variables, use this is syntax
    ----- premise 2 -----
    <cfset a = "label_click">
    <span class="hidden-xs">##= #a# ##</span>

    Best Regards

  4. Ashleigh L
    Ashleigh L avatar
    113 posts
    Member since:
    Jun 2012

    Posted 30 Apr 2015 in reply to Cristiano Link to this post

    Cristiano - wow, I'm such an idiot; I was so focused on the templating stuff I totally forgot about needing cfoutput. Thanks!
Back to Top