views:

33

answers:

1

I need to remove the cache when a user change language, but I get an error message.

  $smarty = new Smarty;
 //$smarty->force_compile = true;
 $smarty->debugging = true;
 $smarty->caching = false;
 $smarty->cache_lifetime = 120;

 if (isset($_COOKIE['country'])) 
  {
 $country = $_COOKIE['country'];

  $language = "eng";

 if ($country == "NO"){    
  $language = "nor";

  $smarty->clear_all_cache();
  }      
 }

I also get this message when i use clear_assign:

function call 'clear_assign' is unknown or deprecated
A: 

Why don't you check Smarty's own manual before asking help here? http://www.smarty.net/manual/en/caching.php

To be honest, I've never used Smarty before and don't think that I will anytime, but after looking in Smarty's manual and then again looking at your code:

$smarty = new Smarty;
//$smarty->force_compile = true;
$smarty->debugging = true;
$smarty->caching = false; # this line clearly states, that nothing will be cached!
$smarty->cache_lifetime = 120;

So, what cache you want to clear afterwards?

Tom
That doesn't matter. The problem is that I get an error when calling the function (caching true or false) when the examples from smarty.net look like this Example 14-5. Clearing the cache<?php// clear out all cache files$smarty->clear_all_cache();?> Exactly the same as what I wrote!
ganjan
When they do "$smarty->caching = 1;" in that example, that's the same as doing "$smarty->caching = true;". That could be the source of your error.
maksim