TinyButStrong - the PHP Template Engine
Categories > TinyButStrong general >

Cashing Subtemplate ?

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: Milop
Date: 2012-09-26
Time: 13:24

Cashing Subtemplate ?

I have blog system where I want to show in sidebar on every page 10 last titles (and links to them).
As I'm using very big SQLite database I don't want to do query on every page.
Is there a way to cache that sidebar template and query and then when loading to all pages (that are also caching) to just call cached sidebar ?
By: Skrol29
Date: 2012-09-27
Time: 01:15

Re: Cashing Subtemplate ?

Hi Milop,

You can use cache feature for sub-template. Just use parameter "script" in the main template. The corresponding sub-script must manage the cache function, with the TBS plug-in r any other cache engine.

By: Milop
Date: 2012-09-27
Time: 17:48

Re: Cashing Subtemplate ?

Hm...I didn't get it.

Here is my issue:

There are many pages with single article and sidebar that should show 10 latest articles.

Single-article.php is cached and inside it is sidebar subtamplate
[onload;script=sidebar.php;subtpl]

Sidebar is also cached but I delete that cache each time when new article is added to blog.

I don't want to delete cache files for single articles.

Problem is that now all those single article cache files contains OLD sidebar.
By: Anonymous
Date: 2012-12-29
Time: 04:41

Re: Cashing Subtemplate ?

Perhaps you could cache the article query - not the complete article page.
By: TomH
Date: 2013-12-10
Time: 17:13

Re: Cashing Subtemplate ?

Milop,
Would you please show the sidebar.php code for setting the page cache?
Thx,
TomH