February 13, 2014

How to add Java Script to smarty template file

{literal}

In smarty, how can you add Javascript to template file.
You just have to use built-in-function named literal.

{literal} tags allow a block of data to be taken literally from the template file. 
Simple logic is there, {literal}{/literal} tags is not interpreted, but whatever we have written within code it will display same.

Syntax:
{literal}

/* Some java script code */

{/literal}
e.g.

<script type="text/javascript">
  function callHello() { 
alert('hello world. !!');   
   }
</script>

Cheers :).

No comments:

Post a Comment

Thank you very much for your comment.
Your message has been successfully sent out to author of this blog.