Tamplate Language — Nosto Community

Tamplate Language

debug_gurudebug_guru Posts: 15Member
Hi,

Which type of programming language does Nosto templates uses.?

Is there any reference or guide related to that?

If I want to perform any split or replace functionality how do I do that? 

Regards,
Deepak Gurung

Comments

  • JacopoJacopo Posts: 47Walking Wisdom, Coding Expert admin
    Hello @debug_guru

    the templating language we use is Apache Velocity, and yes, the Internet is full of guides and how-to.

    But, since you asked, here how you can perform the two operations you have pointed out:


    REPLACE

    #set($mystring = $!product.price.toString().replace("€","$"))
    ## this replace in every price the € symbol with the $ symbol. Everything before being
    ## replaced needs to be converted into string


    SPLIT

    #set($mysplit = $!product.name.split("\&"))
    ## this generates an array called $mysplit with as many elements inside as the & that are found
    ## in the string- those are used in the template like $mysplit[0] $mysplit[1] etc.
    ## for knowing how many elements there are in the templates you can do $mysplit.size()


    Hope this will help :)
  • MaximeMaxime Posts: 13Walking Wisdom admin
    Hi @debug_guru,

    We have some documentation that you can check here as well. 

    Best. :)
Sign In or Register to comment.

Read our Terms&Conditions before commenting and posting