Categories > TinyButStrong general >

Creating "semi-dynamic" pages with TBS

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: matt
Date: 2004-08-15
Time: 05:28

Creating "semi-dynamic" pages with TBS


I'm creating a CMS that will ultimatly write the site to static .html files via PHP, I guess i've seen the approach reffered to as "semi-dynamic." Anyhow, I'm wondering if there is a way to get the Show() method to return the page output as a string that I can then write into an HTML page.

Thanks for any help!
By: achille
Date: 2004-08-15
Time: 19:45

Re: Creating "semi-dynamic" pages with TBS

TBS has a much more powerfull feature for you : caching. You generate your page only once, and as long  as the "TimeToLive" is ok, the page is loaded for  the disk without any calculus.
Extremely simple to use, and  very powerfull, you can make a high trafic site without having your CPU down.

the basi syntax is :

if(!$tbs->CacheAction($page, 3600)){
    $tbs->LoadTemplate("template.html");
here do you usual MergeBlock stuff
    $tbs->Show();
}

$page is the  internal name of your page, 3600 is the time to live of this page is sec
If the file stored on disk is not older than 3600 sec, TBS output it without further calculus, otherwise do the usual stuff and store the file on disk for next request.
By: matt
Date: 2004-08-21
Time: 07:53

Re: Creating "semi-dynamic" pages with TBS

Thank you very much for your reply achille, I had heard of cacheing, but didn't realize it's implications. I'm not totally sure how to do so, but I'll take a look.

Thanks again.