When to put {nocache} {literal}?

Discussion for various published PHP frameworks, including Zend Framework, CodeIgniter, Kohana, CakePHP, Yii, Symfony, and others.

Moderator: General Moderators

Post Reply
toplisek
Forum Commoner
Posts: 31
Joined: Tue Apr 11, 2006 1:23 pm

When to put {nocache} {literal}?

Post by toplisek »

Maybe I will set
{nocache}
{literal}

I'm new to Smarty but when to set
{nocache}
{literal}
User avatar
waytoecommerce
Forum Newbie
Posts: 16
Joined: Tue Apr 12, 2011 11:47 am

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

Post 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}
Post Reply