Forum Discussion

tcarter's avatar
tcarter
Helper
13 years ago
Solved

Is there a Freemarker object for templates?

I have a custom component that loads a bunch of javascript for the desktop template that I do not want loading for our mobile template.

Is there a Freemarker object I can use?

 

Here is a fictitious example of what I am looking for:

 

<#if (template.name != "Mobile") >

   <#-- load all the heavy javascript not needed for mobile here -->

</#if>

  • You can use the "clientDevice" freemarker context object -- here is an example:

     

    <#if clientDevice.mobile>
      <#-- load all the heavy javascript not needed for mobile here -->
    </#if>

     

2 Replies

  • DougS's avatar
    DougS
    Khoros Oracle
    13 years ago

    You can use the "clientDevice" freemarker context object -- here is an example:

     

    <#if clientDevice.mobile>
      <#-- load all the heavy javascript not needed for mobile here -->
    </#if>

     

  • tcarter's avatar
    tcarter
    Helper
    13 years ago
    Thanks, this is exactly what I was looking for. (but I will use
    <#if !(clientDevice.mobile)> to load stuff not needed for mobile...
    Thanks again.
    -Tom