Categories > TinyButStrong general >

Partial cache - Working example please...

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Leonardo
Date: 2011-11-20
Time: 04:26

Partial cache - Working example please...

Just can't make a simple example work, captain.

It's a simple one: Two variables (timestamps). One inside cache.

I guess the result should be a "frozen" timestamp and another one
that changes itself every refresh, if I get the "partial cache" right.

Please help and thanks in advance.

(The forum examples are old, I know...)
By: Skrol29
Date: 2011-11-21
Time: 02:57

Re: Partial cache - Working example please...

Hi Leonardo,

This is a variant of the Cache system example.

include_once('tbs_class.php');
$TBS = new clsTinyButStrong;

include_once('tbs_plugin_cache.php');   // Load the Cache System library
$TBS->PlugIn(TBS_INSTALL, TBS_CACHE, dirname(__FILE__)); // Install the plug-in

$TBS->Render = TBS_NOTHING; // Prevent the cache system to stop the merge and output the result

// Call the Cache System which is deciding wheter to continue and store the result into a cache file, or to retrieve the cached page.
if ($TBS->PlugIn(TBS_CACHE,'testcache',10)) {
} else {
    $TBS->LoadTemplate('tbs_us_examples_cache.htm');
    $TBS->Show();
}

// after the template system
$TBS->MergeField('dyn', time());
echo $TBS->Source;
exit;

HTML:
Cached : [onshow..now;frm='hh:nn:ss']

Stay dynamic : [dyn;frm='hh:nn:ss']
By: Leonardo
Date: 2011-11-21
Time: 17:04

Re: Partial cache - Working example please...

Can't believe it was THAT simple.
(I'm looking so dumb now... Sorry for wasting your time.)

Thank you again and again.