Page 1 of 1

When to put {nocache} {literal}?

Posted: Sat Apr 02, 2011 10:05 am
by toplisek
Maybe I will set
{nocache}
{literal}

I'm new to Smarty but when to set
{nocache}
{literal}

Re: When to put {nocache} {literal}?

Posted: Thu Apr 14, 2011 12:20 am
by waytoecommerce
Use of LITERAL :

When ever you are using js in the middle or in the smarty doc you have to use {literal} tags

Example :

Code: Select all

    {literal}
     <script> function example(a,b) {
	number += a;
	alert('You have chosen: ' + b);
     }
    </script>
    {/literal}
when you want to disable cashing of template section then at that time use {nocache} tags

Code: Select all

{nocache}
   {$smarty.now|date_format}
  {/nocache}