TinyButStrong - the PHP Template Engine
Categories > TinyButStrong general >

Question about TBS and performance

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

By: LeoC
Date: 2014-01-14
Time: 19:53

Question about TBS and performance

Hello,

I would like to know if there is a way to "shoot" a function(1) on a specific part(2) of the template merging.

Just like the code below, but using TBS.

<html>
<head>
  <title>this page</title>
  <link rel=".." href="minum.css" />
  <script src="minum.js"></script>
</head>
<?php flush(); ?>

Maybe it sounds silly. I don't know how to do it yet. But reading about web performance this detail was brought to my attention:

http://www.stevesouders.com/blog/2009/05/18/flushing-the-document-early/

So, I'm asking if it can be done via a (1)Flush() after the HTML (2)Head tag with TBS or outside the class, using the template.
(and of course reuse this function on arbitrary sections of the template).

Thanks in advance.
By: Skrol29
Date: 2014-01-15
Time: 02:26

Re: Question about TBS and performance

Hi LeoC,

This cannot be done this way because the template is not supposed to contains PHP code.

But the plugin MergeOnFly provided with the TBS package gives such a feature. It enables you to merge a big block of data and doing a flush() times to time in order to get better time result and also to give a progressive result to the user when the whole result may be long.

By: LeoC
Date: 2014-01-16
Time: 17:43

Re: Question about TBS and performance

If with the MergeOnFly plugin I can flush() after get page header info
and/or some page sections the problem is solved.

I'll give a try.

Thanks. Again.
By: Skrol29
Date: 2014-01-17
Time: 02:51

Re: Question about TBS and performance

Yes it does.
By: LeoC
Date: 2014-01-17
Time: 19:42

Re: Question about TBS and performance

Just one more question:

Does TBS class works with output control functions while merging and showing data?

Just asking because I realize that can be redundant apply flush() if TBS already does.
(You know, like a specific property or method for large/huge blocks of data).

Thanks.
By: Skrol29
Date: 2014-01-18
Time: 01:10

Re: Question about TBS and performance

You must not and cannot actually manage the output yourself, because the template engine already drive it its own way.

See details at the plug-in page :
http://tinybutstrong.com/plugins.php?help#plugin_mergeonfly