I have caching enabled in my smarty and have assigned a date and time as below that will only be fetched from database if the page is not cached:
$smarty->assign('added_timestamp', $added_timestamp);
I have a custom smarty modifier that generate a relative period like (20 minutes 5 seconds ago)
{$added_timestamp|relative_time}
now what I need is, the value for ‘$added_timestamp’ must be cached however the output from {$added_timestamp|relative_time} should not be cached.
I tried with {nocache}{$added_timestamp|relative_time}{/nocache} but it doesn’t work.
any suggestions?
you will need to wrap your relative_time modifier in a function plugin. that function plugin can be registered with the nocache flag (modifiers can’t).
and
(Smarty3 syntax)