Using Javascript codes in Smarty template files

Posted on July 10, 2010
Filed Under PHP, Smarty | 1 Comment

Using Smarty fist problem I encountered is how to use JavaScript inside the template files! There is this magic keyword literal which will refrain from parsing the code within!

{literal}
<script type="text/javascript">
  function isblank(field) {
    if (field.value == '')
      { return false; }
    else
      {
      document.loginform.submit();
      return true;
    }
  }
</script>
{/literal}

Comments

One Response to “Using Javascript codes in Smarty template files”

  1. Javascript Examples on July 12th, 2010 2:46 am

    that’s all cool coding tip, thank you very much for sharing.

Leave a Reply