Template FAQ

Can I add javascript to a template file?

You can insert JavaScript into your template files but you will need to wrap literal tags around the javascript code. For example:

{literal}
  <script language="javascript">
    ...javascript code here...
  </script>
{/literal}

This same method will work for including Google Adsense*, Yahoo Publisher, and most other advertising programs.

*Please note: We recommend that you do not include Google Adsense code on the userforgot page as there have been reports that the code disrupts the functionality of this page. As a result, you should wrap the above code in an “if” statement:

{if $body != "user/userlogin.tpl" || $smarty.post.action == '' || $smarty.get.key != ""}
{literal}
  <script language="javascript">
    ...javascript code here...
  </script>
{/literal}
{/if}

Can I see what all variables are available for a template file?

Yes you can. Just open the template file layout.tpl and add the following code to the top:

{debug}

This popup a javascript debug console and list all the available variables.