TinyButStrong - the PHP Template Engine


Newsletter and Mailing-list · SVN · Golden Rules · FAQ · Tutorials · Other countries · Change Log · License · Contact

↑ top

Newsletter and Mailing list

If you'd like to receive a tiny flash news-letter when there is a fresh new release or any interesting information related to TBS, then you can subscribe to TBS-news.

If you'd like to participate, comment, criticize, or just get informed about the development related to TBS (the engines, the plugins, , the tools,..), then you can subscribe to the TBS-dev mailing list. Please note that this mailing list is not for getting help on TBS development, the forum is made for that.

↑ top


The source code of the TBS project (engine, plug-ins, tools, ...) is hosted at Sourceforge.

Sourceforge project: https://sourceforge.net/projects/tinybutstrong/ There is nothing really intresting there but the SVN repository.

SVN repository: https://tinybutstrong.svn.sourceforge.net/svnroot/tinybutstrong

↑ top

Golden Rules

Here are some golden rules for TBS Template Engine. If you know them it will be more easy to build and understand your first TBS templates.

When you call a method, TinyButStrong immediately applies changes in property $TBS->Source.

Some other template engines (like Smarty) work by preassigning variables, and the merging is processed in one shot at the end. TinyButStrong doesn't work this way. As soon as you're calling a method, then the effects are immediately applied into property $TBS->source.
For example, just after $TBS->LoadTemplate(...) is called, the property $TBS->Source already contains the wanted template having all [onload] tags processed. Also, when you call $TBS->MergeBlock('b1',...) then $TBS->Source contains the result having block "b1" merged. All [b1] tags have so been replaced and no longer exist.

Knowing this, you can understand that the order of which you are merging blocks can affect the result.
In the example below, merging blocks "gender" and "vip" will not produce the same result has "vip" and "gender". (see golden rule #4 for more details)
[vip.name;block=tr] Gender:
[var] fields are merged when $TBS->Show() is called.
Except for parameters file , script , subtpl , if , then , else , when.

Special parameters listed above quite always need to contain expressions. That's why TBS try to merge [var] fields in those parameters when a tag is merged. But all other [var] fields are merged only when method Show() is called.

The following tag won't display correctly : [b1.date;frm=[var.format]]

To workaround this behavior, you have two solutions:
1) Call the method $TBS->MergeField('var');
This will force to merge [var] fields immediately.
2) Since TBS version 3.2.0 you can define var fields which are explicitely merged when the template is loaded. Example to merge $x : [onload.x].
Block parameters are taken into account only if parameter "block" is also defined.

TinyButStrong has some block parameters and some field parameters which are all different.
- if / then / else are field parameters, and when / default are block parameters.
- magnet / mtype are field parameters, and bmagnet is a block parameter.

Whether you are using the normal syntax or the simplified syntax, a tag is recognized has a block tag only if it has the parameter "block." If it hasn't such a parameter, then any other block parameters are simply ignored by TBS and you won't have any error message for that because TBS allows any extra parameters.

Examples of bad and good:
Bad Good
[b1.col1;bmagnet=div] [b1.col1;magnet=div]
[b2;block=tr;frm='yyyy-mm-dd'] [b2;block=tr]
[onload;when [var.x]=1] [onload;block=tr;when [var.x]=1]
[var.x;when [var.x]=1;then 'one'] [var.x;if [var.x]=1;then 'one']
Contents placed between the sections of a same block are always deleted.

In the example below, the block named "b1" has two sections (a yellow one and a blue one). An orange row is placed between those two sections. But when the block "b1" is merged with $TBS->MergeBlock('b1',...) then the orange row will be completely deleted and will never be displayed. TinyButStrong does not keep this zone simply because there is no logical way to process it. When you define the sections of a same block, there should not be any contents between them.


This behavior also explains why you're loosing the line breaks placed between <tr> when your template contains "block=tr". The line breaks between <tr> are deleted, all <tr> sections of the block are collapsed. If this is a problem for you, you can try the definition "block=tr+_" (see the manual to know more).
During Subtemplate Mode, all outputs are buffered and not displayed.

Parameters "script" and "file" can make TBS to work in a subtemplate mode. In this subtemplate mode, any normal output is stored into a buffer (this includes PHP error messages). When TBS get out of the subtemplate mode, then the buffered data is placed into the template.
Thus if for some reasons a PHP fatal error occurs and stops the running script, then no buffered data is prompted and all what you'll see is a blank page. If you met such a problem, we suggest that you debug your subscript in a normal mode.
If a PHP error occurs but does not stops the running script, then PHP error message will be inserted inside the main template.

↑ top


How to:

spot How to change markers '[' and ']' to '{' and '}' or something else ?
spot How to load a template from string instead of a file ?
spot How to limit the usage of global variables in the template ?
spot How to save the merge in a string instead of display it direcly ?
spot How to make a condition for parameter if/when using operators like AND, OR ?
spot When can I embed Var fields into other TBS fields ?
spot When can I use keyword [val] ?
spot How to have a headergrp containg sections of the same block ?
spot How to optimize when the merge is too slow ?

-> There is also a Tips & Tricks forum for more How To.


spot Why '[' chars are converted into Html code '&#91;'
spot All TBS fields are ignored in my subtemplate
spot The MySQL example page doesn't work localy
spot I have the error TinyButStrong error : the cache file '...' can not be saved
spot My subtemplate is included at the beginning of the template
spot The nodata section is not displayed when data is empty
spot Some block parameters (like 'ondata', 'parentgrp',...) seem to be ignored
spot Some [onload] blocks are never displayed despite the 'when' statement
spot The merge is too slow, how can I optimize ?

-> You can also perform a search in the forum for more aswers to your problem.

spot How to change markers '[' and ']' to '{' and '}' or something else ?

Field and block markers have been set to '[' and ']' only for optimisation consideration.
'{' and '}' are common in Javascript code and Style definitions, but '[' and ']' are more rare.

TBS >= 2.02
Markers can have several characters.
  $TBS = new clsTinyButStrong('{{,}}');

TBS 2.00 and 2.01
Markers must have only one character.
  $TBS = new clsTinyButStrong('{}');

TBS 1.x (>= 1.60)
Markers must have only one character.
  $GLOBALS['tbs_ChrOpen'] = '{' ; // to set after include_once('tbs_class.php')
  $GLOBALS['tbs_ChrClose'] = '}' ;

TBS < 1.60
Markers cannot be changed.

spot How to load a template from string instead of a file ?
  $TBS->Source = $my_string;

To process [onload] tags if any, with TBS >= 3.0

To process [onload] tags if any, with TBS < 3.0
spot How to limit the usage of global variables in the template ?
Limit the hallowed global variables by a prefix:

The second argument of the TinyButStrong instantiation enables you to define a prefix for variable limitation in the template.
  $TBS = new clsTinyButStrong('','pref_');
Other Var fields will produce a TBS error when the template is processed.

Limit the hallowed global variables by a list:

  $allowed_vars['var1'] =& $var1;
  $allowed_vars['var2'] =& $var2;
  $TBS = new clsTinyButStrong('','allowed_vars');
spot How to save the merge in a string instead of display it direcly ?
  $TBS->Render = TBS_NOTHING; // No exit, no output
  $TBS->Show()                           // Merges Var fields and [onshow] fields
  $result = $TBS->Source             // Get the current result

More info about the properties Render and Source.
spot How to make a condition for parameter if/when using operators like AND, OR ?
  Parameters 'if' and 'when' don't support logical operators, but only comparaisons bewteen two strings.

Operator AND can be replaced by a string concatenation. For example:
  [onload;if '[var.x1]-[var.x2]'='a-b';then ...]
  This condition is the same as: ([var.x1]=='a') AND ([var.x2]=='b')

Since TBS 3.0, you can define several if/then parameters. For example:
  [onload;if [var.x1]=1;then 'One';if [var.x1]=2;then 'Two';if [var.x1]=3;then 'Three';else 'More than three']

But for OR usage, and also for more complicated expressions, you will need to use a custom function to performe the check. Example:
  function f_mycheck($FldName,&$CurrVal) {
    global $x1, $x2;
    if (($x1=='a') OR ($x2=='b')) then {
      $CurrVal = 'ok';
    } else {
      $CurrVal = 'not ok';
spot When can I embed Var fields into other TBS fields ?
  Var fields are always examined into parameters 'file', 'script', 'when', 'if', and since TBS version 2.02: 'then', 'else' and 'subtpl'. TBS fields are not examined in others paremeters. So if you use embedded Var fields in other paremeters, they won't be merged in the same time as the embeding field.
spot When can I use keyword [val] ?
  Keyword [val] is supported in parameters 'file', 'script', 'if', 'then', 'else' and 'subtpl'. In other parameters this keywords is considered as a common string.
Keyword [val] is sensitive to the TBS tags markers. For example, if you set the TBS markers to '{' and '}', then the keyword becomes {val}.
spot How to have a headergrp containg sections of the same block ?
  Since TBS version 2.02, there is a new parameter 'parentgrp' that enables you to display a header section that can contain sub-sections of the same block. This is the only case when a TBS section can embed sections of the same block.
spot Why '[' chars are converted into Html code '&#91;'
  Since version 1.64, TBS has a Protection System which is enabled by default for each field. This protection consist in replacing all characters '[' with its Html equivalent '&#91;' for any merged data coming from outside the template (Php variables, MySQL,...). You can deactivate the Protection System for any TBS fields using parameter 'protect=no'.
See the manual for more details.
spot All TBS fields are ignored in my subtemplate
  With TBS version < 2.02, the Protection System stay activated for parameter 'script'. So if you use this parameter to insert something containing TBS fields, then this fields are disabled by replacement of characters '[' with '&#91;'
To by-pass this problem, you just have to set parameter 'protect=no' in the TBS tag, or to us TBS version >= 2.02.
Example: [onload;script=subcode.php;protect=no]
spot The MySQL example page doesn't work localy
  This example provided with the TBS Example Set needs to have a specific MySQL table and to connect to it. This table is available at this web site but not on your computer. The error message return by PHP is:
Fatal error: Failed opening required '/cnx_mysql.php' (include_path='.;c:\php\includes') in [...]\tbs_us_examples_datamysql.php on line xx
spot I have the error TinyButStrong error: the cache file'...' can not be saved

This error message occurs when PHP raise an error when attempting to save the cache file on the server.
Most of the time, this is because there is no 'write' permission on the directory. Try to chnage the Unix permisson
Then you should probably change the Unix permission of the directory on the server where you're trying to save the cache file.

spot My subtemplate is included at the beginning of the template.

This can happen if you used the parameter 'script' instead of parameter 'file'.

spot The nodata section is not displayed when data is empty.
  First check that you 'nodata' section is not embedded into another section of the block.
If you're merging data stored into an array, then an empty data should bee an empty array ( like array() ) ; values null or false are not considered an empty data. They simply cannod be merged.
Example of what you can do to be sure that data is not the false or the null value:
  $data = ...
  if ($data===false) $data = array();
spot Some block parameters (like 'ondata', 'parentgrp',...) seem to be ignored
  They are two cases when a block parameter seems to be ignored by TBS. The first one in when the block parameter is not placed in the TBS tag that contains the block definition. That is TBS tag with parameter 'block=...'. The second case is when you have too much parameter 'block=...' inside a section. In such a case, only the first parameter 'block=... ' is taken in acount ; following block definition are ignored (note taht with explicit syntax, following tag with 'block=end' is accepeted).

Here are some examples :

*  <div>[blk1.firstname;block=div] ... [blk1.subname;ondata=my_function]</div>
Bad : parameter 'ondata' is ignored because there is no block definition ('block=...') in its TBS tag.

*  <div>[blk1.firstname;block=div] ... [blk1.subname;block=div;ondata=my_function]</div>
Bad : parameter 'ondata' is ignored because a previous block definition ('block=div') has been taking in acount. Don't forget that only one parameter 'block=' is enougth for each section of a block (two with explicit syntax).

*  <div>[blk1.firstname;block=div;ondata=my_function] ... [blk1.subname]</div>
Good : Block parameters are placed together.
Some [onload] blocks are never displayed despite the 'when' statement
  A usual mistake is when you put TBS a field linked to a block inside the conditional statement of an [onload] tag. Remember that an [onload] tag is automatically processed as soon as you call the LoadTemplate() method. Therefore, no TBS field of block is merged yet because no MergeBlock() method has been called before.

Example :

*  <div>[onload;block=div;when [blk1.colmun]=3] ... </div>
Bad : The TBS fields [blk1.colmun] is not yet merged before calling LoadTemplate().
TBS is just checking is string '[blk1.colmun]' is equal to string '3'. Which is always false.

*  <div>[onshow;block=div;when [blk1.colmun]=3] ... </div>
Good : TBS field [blk1.colmun] can be merged before calling Show().
spot The merge is too slow .
TinyButStrong is a Template Engine which has good merging performance. Just a bit faster that Smarty or other without template compilation. Like for any Template Engine, the speed of your merge depends a lot on your template's structure. Here are some advices for optimizing your templates.

spot Don't multiply automatic fields [onshow]. It means that you'd better not put such TBS fields inside some sections of your template that will be merged with data. Otherwise, the number of this fields will be multiplied before to be processed ([onshow] tags are processed when Show() method is called). This can slow down your merging very much.
* You can often by-pass this problem by replacing [onshow] fields with [onload] fields. [onload] tags are processed just when LoadTemplate() is called. That is inevitably before any block merging. So you maybe have to prepare Php variables used for the conditional statement before this method is called.
* Please also notice that you can use conditional sections of block instead of [onshow] blocks. Conditional sections of block are normal sections with a parameter 'when'. Such sections are faster than [onshow] blocks.
spot For the same reason, don't multiply Var fields or other TBS fields that could be evaluated only once before a block is merged.
* You can force Var fields to be merged when you need using MergeSpecial() method.
* You can also force custom fields to be merged when you need using MergeField() method.
spot Use parameter 'selected' with parsimony (not too much). This parameter is quite smart but it needs Html analyse processes. Such processes cost certain execution time. This is not sensible if they are not numerous, but they can slow down the merge when they are much.
* If you have numerous checkboxes/radio/lists to select, then you can by-pass this problem by setting them using Javascript function on the OnLoad attribute of the <body> tag. Another way is to prepare one or several variables in the Php side that will add the 'checked' attributes in the tags when needed.
* Please also notice that the more your <form> section is big, the more Html analyse processes cost time. Think also that you can limit this section using parameter 'selbounds'.
spot When your template has many complex dynamic parts, it is better to migrate the conditional statements from the Html side to the Php side.
* You can use a custom function with parameters 'onformat' and 'ondata' which is often evaluated faster than if / then / else expressions in TBS fields.
* You can retrieve data to merge in an array, sort them, filter them, calculate some new columns in the Php side. Then merge such prepared array with a simple block.

↑ top


Don't hesitate to submit new tutorials...

Tutorial   Author
Webdesign tutorials (in german)   Manuel
Webdesigner with tutorials (in german)   Manuel
PHP 5 Object + TinyButStrong - How to create a structured website (download) Titi

↑ top

Other countries

Here is some ressources about TinyButStrong translated into other languages:

Language Ressource
glob German Webdesigner tutorials talks abouit many thinks including TBS template engine
glob German TBS crashcourse and tutorial (thanks to Claus)
glob French Site partially translated

↑ top

Change Log

Version Date Fixes / new features

3.9.0 2014-01-26
New features:
New feature New parameter "parallel" for merging a block in columns (or any other parallel ways).
New feature New way for merging sub-template: PHP error messages are not absorbed any more.
This new way may not be compatible with subscripts that uses the echo command (very rare). In this case you should add set option $TBS->SetOptions('old_subtemplate') for compatibility.
Enhancement Error messages are in plain text instead of HTML when PHP is used in command line (CLI).
Enhancement Now can merge DateTime objects and also objects with the magic method __toString().
Enhancement Some code enhancements.
Fixed bugs:
Fixed bug HTML plug-in version 1.0.8: parameter "select" now works with values containing special HTML characters.
Fixed bug Parameter "frm": leading zero coming with a prefix or a suffix may not format the number as expected.
Fixed bug There use to have an error message about $Loc->AttForward when the entity of parameter "att" is not found.

3.8.2 2013-04-20
New features:
New feature New option "methods_allowed" for allowing methods on automatic fields.
Fixed bugs:
Fixed bug Explicit error message when a column is missing for a grouping parameter (headergrp, footergrp, splittergrp)

3.8.1 2012-04-01
Fixed bugs:
Fixed bug Plugin MergeOnFly: debug mode was activated by default.
Fixed bug Error with PHP 5.4 : Unexpected PHP error [Array to string conversion] severity [E_NOTICE] in [tbs_class.php line 72]

3.8.0 2012-03-04
New features:
New feature New property VarRef: enables you to redefine the scope of automatic fields ([onshow], [onload] and [var])
New feature New data source supported in native: Zend DB Adapter
New feature New methods SetOption() and GetOption(): hamonize the management of TBS options.
New feature Option "include_path": enables you to define include paths for templates and sub-templates.
New feature Option "block_alias": enables you to define alias of block.
New feature Option "tpl_frms": enables you to define TBS formats.
New feature parameter 'frm' now supports the thousand seperator with several characters. Useful for Html entites for example.
New feature New values supported by parameter "ope": upper, lower, upper1, upperw, utf8
New feature New parameters store and storename: enable you to bufferize the content of a sub-templates in a store, that you can replace anywhere in the main template using [onshow..store]. Usefull for developping sub-templates as components.
New feature New special field [onshow..php_info]: insert the php info.
Enhancement New property ExtendedMethods: enables plug-in coders to add new TBS methods (PHP 5 only)
Enhancement Parameter magnet=# is supported even if parameter att is not used.
Enhancement Parameter enlarge is a new alias of parameter comm
Enhancement Parameter getpart is a new alias of parameter getbody
Enhancement Parameter strconv is a new alias of parameter htmlconv
Fixed bugs:
Fixed bug A string [] appears in the contents when parameter "att" is used with a "parentgrp" block.
Fixed bug using parameter getbody : Notice: Trying to get property of non-object in ...\tbs_class.php on line 3775
Fixed bug with PHP 4 (who use it?): PDO::FETCH_ASSOC is not recognized

3.7.0 2011-03-18
New features:
New feature Support MySQLi connectivity in native.
New feature Support PDO connectivity in native.
New feature MergeBlock() accepts a new argument for Query parameters.
New feature Method PlugIn() support direct commands.
New feature New internal method meth_PlugIn_SetEvent() for enable/disable a plug-in's event.
New feature New f_Xml_FindTagStart() which can be useful for plug-ins and external tools (yet used in OpenTBS and Excel plug-in)
Enhancement Better management of fields put in cache when parameter att is used.
Fixed bugs:
Fixed bug Internal method f_Xml_AttFind() does not find attributes that have uppercase characters, that's because f_Loc_PrmRead() save attributes lowercase.
Fixed bug Internal method f_Misc_GetFile() founds the correct size using fstat().
Fixed bug The special automatic field [onshow..template_date] now call f_Misc_GetFile() in order to be sure to found the file the same way.
Fixed bug Parameter mtype=*m or mtype=m* does't use encapsulation level. Now it can find <br />.
Fixed bug When parameter ondata is used on a array string then $CurrRec is not an array. "Warning: Cannot use a scalar value as an array in [...]"

3.6.1 2010-10-29
New features:
New feature Automatic subblocks can now be direct, i.e without a column.
Fixed bugs:
Fixed bug MergeBlock() with 'text' source doesn't work with multiple blocks.
Fixed bug Parameter rename (to be used with parameters file or script) doesn't rename fields that have no subname or parameter.

3.6.0 2010-09-14
New features:
New feature New keyword htmlconv=utf8: enables you to directly convert the data item into UTF-8.
New feature New operator msk: apply a mask on the current data item. Example; ope=msk:prefix_*_suffix
New feature New plugin event OnCacheField, it's triggered when a field is put in the cache of a block definition.
New feature New properties OnLoad and OnShow: enable you to prevent the processing of automatic fields and blocks. May be useful for plug-ins
New feature New parameter atttrue (mean "attribute true"). To be used with parameter att. Turn the attribute to have a Boolean behavior, which becomes true for the given value. Example: [var.x;att=input#selected;atttrue=29] will add "selected=selected" if $x=29, otherwise the attribute is omitted.
New feature TBS can now restrict the PHP functions allowed for parameters ondata and onformat.
Example: $TBS = new clsTinyButStrong('','','f_allowed_');
New feature Automatic subblocks now support optional columns. The column is optional if is defined with parenthesis. If the optional column is missing then the subblock is considered as empty.
Example: [author;block=tr;sub1=(books)]
Fixed bugs:
Fixed bug Parameter getbody without value is not working.
Fixed bug Parameter att doesn't work when placed in inside the target tag and before the target attribute. http://tinybutstrong.com/forum.php?msg_id=10899
Fixed bug GetBlockSource() with arguments AsArray=false and DefTags=false does ignore DefTags=false.
Fixed bug If an automatic subblock has a null value instead of nodata then it displays "TinyButStrong Error when merging block [xxx_sub1] : unsupported variable type : 'NULL'.". This bug is now fixed and a null value means an empty subblock.
Fixed bug A subblock with a dynamic queries can display "TinyButStrong Error when merging block" (with the keyword %p1% in the query) when it founds parameter "p1=" without value. This can happen for instance when the main block had a null or empty value for the linked column.
Fixed bug Parameter valsep (to be used with ope=list) doesn't work as expected if its value is HTML/XML encoded. The final value includes re-encoded value separators.

3.5.3 2010-04-12
Fixed bugs:
Fixed bug "Notice : Undefined property: clsTbsLocator::$RightLevel". This warning message appeared in TBS 3.5.2 when you use block=_ .

3.5.2 2010-04-08
New features:
New feature XML/HTML single tags <x/> are now considered like <x></x>. Thus, coding "block=img" will work correctly if the TBS fields is embedded in the <img/> tag. Example: <img [b;block=img] />
New feature Parameter frm supports leading zeros. Example: frm=00. (idea submitted by Jérémy)
New feature New parameter maxutf8 allows the max operator to work with utf8 data. (idea submitted by Jérémy)
Example: [onshow.x;ope=max:10;maxutf8]
New feature New operator mok (means Magnet OK). To be used with parameter magnet. Example: [onshow.x;magnet=div;ope=mok:xxx]. The TBS field is never displayed, but the magnet tag is displayed only if the TBS field’s value is xxx. Otherwise, the magnet tag is deleted.
New feature New operator mko (means Magnet KO). Same as mok but the magnet tag is deleted only if the TBS field’s value is xxx.
New feature New keyword: htmlconv=url enables you to formate a string to be instered in URL.
Enhancement Deleting an attribute using magnet=# does no longer add a new space in the tag.
Enhancement f_Xml_FindTag() is a bit faster.
Enhancement Some code embellish.
Fixed bugs:
Fixed bug Defining a block on a single tag using "block=tag/" doesn’t work. TBS did not manage the embedding level correctly.
Fixed bug "Warning: Parameter 4 to ... expected to be a reference, value given"
Error message when using a plugin event OnFormat or an onformat custom function that use the argument $TBS. Happens only since PHP => 5.3.0. (bug reported by Jérémy)
Fixed bug The virtual column $ returns the record num instead of the item key when calling MergeBlock with a datasource which is an ArrayIterator. (bug reported by Jérémy)
Fixed bug MergeField('onload'), MergeField('onshow') and MergeField('var') produce a TBS error message about property Assigned. This bug has appeared since TBS 3.5.0. (bug reported by Achille)
Fixed bug Parameter ope=nif is not working when the value to merge is not a string. (bug found by Figo)

3.5.1 2009-12-08
New features:
New feature New parameter rename to change the name of TBS blocks and fields when a subtemplate is insterted.
Fixed bugs:
Fixed bug

Support block definitions on XML tags that can be either single or opening/closing couple. Since XHTML, tags such as <div /> are allowed. Now they make no error to found the bounds a TBS blocks when such tags are used.
Example: <div> <div /> [onload;block=div] </div>

Fixed bug

When a XML/HTML attribute was not correctly ended the TBS could produce an infinite loop under some circumstances.   For example when using parameter att, or with plug-in HTML.

Fixed bug $TBS->TplVars was erroneously cleared when $HtmlCharSet='+'.
Fixed bug New way of checking PHP version.

3.5.0 2009-11-12
New features:
New feature New parameter att. This is a powerful feature that moves a field inside an XML/HTML attribute before to merge it. Parameter attadd makes the merged value to be added to the current attribute's value instead of replace it.
New feature New property Assigned to prepare data to be merged manually or automatically with MergeBlock() and MergeField().
New feature MergeBlock() allows automatic subblocks. When the source of the data has a column containing subdata, then it is possible to define a subblock that will be merged automatically without needing an extra MergeBlock().
New feature Method MergeBlock() natively supports Iterator, ArrayObject and IteratorAggregate. (PHP 5 only)
New feature New special var field [var.error_msg] which displays TBS error messages in your template when property NoErr=true.
Enhancement MergeField() allows to define a set of default parameters.
Example: $TBS->MergeField('mf',date('Ymd'),false,array('frm'=>'dd/mm/yyyy'));
Enhancement Parameter getbody can now retrieve several parts of the subtemplate, including tags or not.
Example: [onload;file=;getbody=(script)+(style)+body]
Enhancement MergeBlock() allows columns names with spaces.
Enhancement GetBlockSource() allows to delete the block source or to replace it with a string.
Enhancement Method LoadTemplate() supports a Charset argument that is an array.
Fixed bug Security fix: automatic fields ([onload], [onshow] and [var]) are not allowed to call object's methods unless property $TBS->MethodsAllowed is set to true.
Fixed bugs:
Fixed bug Fatal error: Call to undefined method clsTbsDataSource::f_Misc_CheckArgLst().
Fixed bug Notice: Undefined property: clsTinyButStrong::$_PlugIns_Ok_save
Notice: Undefined property: clsTinyButStrong::$_piOnFrm_Ok_save
Fixed bug Fix a potential problem about respecting plugin syntax: plugin's events OnFormat and OnOperation.
Fixed bug Warning of 2 undefined variables. See http://tinybutstrong.com/forum.php?msg_id=9265
Fixed bug Parameter mtype doesn't work properly when use with ope=minv. See http://www.tinybutstrong.com/forum.php?msg_id=9814
Fixed bug The merging process doesn't found a property added manually on the instance of an objet. See http://www.tinybutstrong.com/forum.php?msg_id=9508
Fixed bug A template format with numerical definition can not be displayed correclty.
  TBS is under the LGPL license version 3 instead of 2.1

3.4.0 2008-05-30
New features:
New feature New parameter tplfrms to create template formats. Template formats are TBS format for date and number which is defined once and can be references by its name.
Example: [onload;tplfrms;doll=$ 0,000.00] ... [var..amount;frm=doll]
New feature New keyword (locale) for date formats. Insert this keyword inside a date format in order to specify that the formatting must use the loclae settings.
Example: [var.date;frm=(locale)mmmm yyyy]
It does the same as the seperated parameter locale which becomes deprecated.
Fixed bugs:
Fixed bug Avoid infinite loops when a subblock meets an SQL error.
Fixed bug Bad condition evaluation when the first element contains the symbol equal (=). Now it can be escaped with single quote (').
Fixed bug Now, LoadTemplate(null,HtmlCharset) do run Plugins, Onload and HtmlCharset without changing the template, like the documentation says.
Fixed bug Now, LoadTemplate('',HtmlCharset) do change HtmlCharset without changing the template, like the documentation says.
Fixed bug Now, formatted dates with the locale option are converted with the HtmlCharset of the template. This is because they may have accents.

3.3.0 2008-02-29
New features:
New feature LoadTemplate('',$charset) set the charset without changing the current template.
This enables you, for example, to load a template from a string and then set the relevant chartset.
New feature New plug-in event: OnMergeGroup.
It occurs when a header, a footer or a splitter is merged.
New feature Parameter ope=nif:xxx replaces the value with null when it's equale to xxx.
It's a shortcut for [val]='xxx';then '';.
New feature Parameter ope=minv makes parameter magnet work properly but turns the final value to be null.
This i a way to make invisible fields which can manage magnets stuffs.
Enhancement Paremeters headergrp, parentgrp and footergrp work for any kind of data source (array, object, ...) and also with sub items. You can even use the virtual columns # and $.
Example: [blk;block=tr;headergrp=#] or [blk;block=tr;headergrp=ident.name]
Enhancement Fields in the conditional clause of a section are also cached.
Enhancement Templates and subtemplates are also searched in include_path.
Enhancement Custom functions for LoadTemplate support a new argument to process newline characters.
Enhancement MergeField('onload') also merges variable fields such as [onload.x].
Enhancement MergeBlock('blk','cond') also merges var fields such as [blk.x] and [blk;file=...] just like [onload] and [onshow] do.
Enhancement The code source has no more plublic functions.
Fixed bugs:
Fixed bug Wrong merging when a block is using parameter "p1" and having a field outside the block.
See related topic
Fixed bug Now [var..now] uses time() instead of mktime().
See related topic
Fixed bug Now there is a TBS error message when [onload;block=...] doesn't found the block which is defined.

New feature New feature: Onload [var] fields.
Now a field like [onload.x] can display a PHP variable $x as soon as the template is loaded. It is very useful for optimization.
New feature New feature: special var field [var..cst.*]
Display a PHP constant.
New feature New feature: special var field [var..tbs_info]
Display some information about TBS version, PHP version and installed plug-ins.
New feature New feature: enhancement for parameter ope.
Parameter ope can have several operations. It supports real values, and two new operations : div and mul.
Example : [var.x;ope=mul:2,add:1.5]
New feature New feature: enhancement for files.
The LoadTemplate() method, and both parameters file and script also look their file in the directory of the last opened template. It can be useful to simplify subtemplate inclusion.
New feature New feature: new time formats.
- h for hour-24 without the leading zero,
- rr for hour-12 with the leading zero,
- r for hour-12 with the leading zero,
hm becomes deprecated. You cannot use double quote (") as a string delimiter in date-time formats anymore, only simple quote (').
New feature New feature: undocumented property ErrCount.
Incremented when a TBS error is met.
New feature New feature: undocumented property RecheckObj.
Enhancement Optimization: The class is smaller and faster than previous versions.
Enhancement Enhancement: Some error messages are clearer.
Fixed bug Fixed bug: an extra empty line could be displayed when using parameter serial and headergrp in the same block.
Fixed bug Fixed bug: Warning: Missing argument 3 for tbs_misc_getfile()
This message could appear under certain circumstances.
Fixed bug Fixed bug: Bad eror message could be prompted when a custom function fail to open a query.
Fixed bug Fixed bug: Problems when another script create functions array_key_exists() and property_exists() before TBS does.
Fixed bug Fixed bug: An unwanted extra line could be added when parameter block=_ was used on a TBS tag placed on the very beginning of a line.
Fixed bug Fixed bug: HTML attribute not recognized when glued to the bottom of its tag.
Example : <input value="1"/> could be not recognized.
+ Internal change: Code optimized for block analysis.
$LocR structure modified (undocumented, this is for plug-in developers).
+ Internal change: Code optimized for custom function check.
You can now preload a custom function set associated with a keyword. (undocumented).

Fixed bug Fixed bug: Bad result when using parameter magnet with mtype=*m
In TBS 3.1.0 a field using this value was always bad processed.
3.1.0 2006-06-13
New feature New feature: block=_
Now you can define a block to be the file line on which the TBS tag is defined. This feature recognizes Linux, Mac and Windows new-line chars. Among other things, this can be useful when you're working on text files.
It also works for extending blocks. Example : block=_+(_)+_ or block=span+_
New feature New feature: block=tag/
By adding character / at the end of the tag's name, TBS won't retrieve the closing tag. The block will be defined on the single openning HTML tag which contains the TBS tag. This can be useful to multiply an image for example.
Fixed bug Fixed bug: Bad merged blocks when using a definition like block=tag+tag
TBS could make a confusion on block's limits when using a block's definition containing several tags with common names.
Fixed bug Fixed bug: TinyButStrong Error: item ... is neither a method nor a property in the class ...
This message could happen when a TBS field tryied to display the an object's property having a null value. Now the null value is corretly taken in acount, but because of PHP restrictions, undefined properties won't produce a TBS error anymore with PHP version lower than 5.1.0.
Fixed bug Fixed bug: The plug-in event Ondata started before event BeforeMergeBlock.
Now BeforeMergeBlock event always start before Ondata.
Fixed bug Fixed bug: Notice: Undefined offset:  0 in ... on line ...
This message could happen when you tried to merge a block that have special sections (like serial or headergrp) but no normal sections. Such blocks can now be merged without error message.
Fixed bug Fixed bug: Variables $CurrVal and $CurrPrm not available when using parameter script.
Those variables were mentioned in the manual but not available. Now they are.
Fixed bug Fixed bug: Error message: pg_fetch_array(): Unable to jump to row ...
This could happens under misterious circumpstances when using PostgreSQL and PHP 5.
Fixed bug Plug-in HTML and ByPage need to be upgraded to works with TBS 3.1.0

Fixed bug Fixed bug: error when using MergeBlock() with objects.
Fixed bug Fixed bug: date formated displays 1st jan 1970.
This could occur with PHP 5.1.0 or higher and with a value which is a timestamp. This is because since PHP 5.1.0, the function strtotime() returns false instead of -1 for a bad time value.
You have a description of the problem in the forum.
Fixed bug Fixed bug: Problems with data or variables when using the TBS syntax for subitems.
Some data change could occur in some circumstances:
- [var] fields calling an object's method
- Array dynamic queries calling an object's method or property
- Parameter onformat or ondata calling an object's method or property
Fixed bug Fixed bug: Error message Warning: Missing argument 1 for aftershow() in ...
This could happen when a plug-in is installed in a sub-template script (called by parameter script).
Plug-in CacheSystem has been changed too in order to feet with this fix.
Fixed bug Fixed bug: Bad argument supplied to plug-in's event OnMergeField.
Fixed bug Fixed bug: Problems with plug-in's event AfterShow.
Now Ouput and Exit happens after event AfterShow. You can cancel them using argument $Render.
Plug-in CacheSystem has been changed too in order to feet with this fix.
+ Comments in the file tbs_plugin_syntaxes has been uptated.
Fixed bug Fixed bug: [var] fields embedded into a parameter 'script' were not merged.
Fixed bug Fixed bug: [var] fields embedded into a parameter 'script' were not merged.
New feature Lot of new features, see document [What's new with TBS 3.0]

backup Changelog for TBS 2.x is backuped here.

backup Changelog for TBS 1.x is backuped here.

↑ top


TinyButStrong is released under the LGPL (Lesser General Public Licence).
In summary it means that:
- it's free to use it,
- you can modify it,
- it can be used as a part of both free and not free softwares.
Read other terms and conditions at the LGPL offical web site.

↑ top


For questions, help, how to, bug reports, comments... contact us.