Question about caching [SOLVED]
Posted: Fri May 04, 2007 2:39 pm
I´m working on a very bad implemented members area for one of my customers. The former coders have done it the following way:
1. They made content page let´s say with the id 40 (not cached).
2. They made a special template for this page.
3. This template has no $content in it, but a $customerContent for a user defined tag.
4. In the user defined tag they made an if statement for the login and decided to show:
a) the page with id 40 (direkt grabbing from the db and using a print statement)
b) custom content depending on the login
Now I´m working on implementing the usage of smarty in this solution.
The problem is that I need to render code from a string using smarty-tags.
The following way this would work (code of the user defined tag):
function bb_replace($tpl_source, &$smarty)
{
$page = '';
if (...) {
$page .= 'a';
}
} else {
$page .= 'b';
}
}
return preg_replace("//", $page, $tpl_source);
}
global $smarty;
//$smarty->caching = 0;
//$smarty->clear_all_cache();
$smarty->register_prefilter("bb_replace");
$smarty->fetch("file:(...)customer.tpl", null, null, true);
I only need a special template which simply contains:
and nothing else.
I only have one problem with this new solution:
CMS MS caches this page (even if the content page has selected no caching)!
Therefore if I reload this page and the if statement would be the other case as before,
it shows the same as before. Deleting the cache in the admin interface, solves the
problem for the next site loading, but after that it´s cached by CMS MS.
I tried the two commented lines in the user defined tag, but that didn´t solved my
problem. Does anybody know how and where I can deactivate the caching for this page?
Greats from Germany
LeisureLarry
1. They made content page let´s say with the id 40 (not cached).
2. They made a special template for this page.
3. This template has no $content in it, but a $customerContent for a user defined tag.
4. In the user defined tag they made an if statement for the login and decided to show:
a) the page with id 40 (direkt grabbing from the db and using a print statement)
b) custom content depending on the login
Now I´m working on implementing the usage of smarty in this solution.
The problem is that I need to render code from a string using smarty-tags.
The following way this would work (code of the user defined tag):
function bb_replace($tpl_source, &$smarty)
{
$page = '';
if (...) {
$page .= 'a';
}
} else {
$page .= 'b';
}
}
return preg_replace("//", $page, $tpl_source);
}
global $smarty;
//$smarty->caching = 0;
//$smarty->clear_all_cache();
$smarty->register_prefilter("bb_replace");
$smarty->fetch("file:(...)customer.tpl", null, null, true);
I only need a special template which simply contains:
and nothing else.
I only have one problem with this new solution:
CMS MS caches this page (even if the content page has selected no caching)!
Therefore if I reload this page and the if statement would be the other case as before,
it shows the same as before. Deleting the cache in the admin interface, solves the
problem for the next site loading, but after that it´s cached by CMS MS.
I tried the two commented lines in the user defined tag, but that didn´t solved my
problem. Does anybody know how and where I can deactivate the caching for this page?
Greats from Germany
LeisureLarry