### Initialize and Render TinyButStrong Template
Source: https://www.tinybutstrong.com/examples.php?e=prmatt&m=php
This script demonstrates the basic setup for TinyButStrong. It includes the library, defines variables for template parameters, loads the 'tbs_us_examples_prmatt.htm' file, and outputs the rendered result.
```php
LoadTemplate('tbs_us_examples_prmatt.htm');
$TBS->Show();
```
--------------------------------
### Initialize and Use TinyButStrong Cache Plugin in PHP
Source: https://www.tinybutstrong.com/examples.php?e=cache&m=php
This snippet shows how to include the TinyButStrong class and the Cache System plugin. It then installs the plugin and uses it to manage cached content, deciding whether to display a cached version or generate a new one based on a cache key and expiration time.
```php
PlugIn(TBS_INSTALL, TBS_CACHE, dirname(__FILE__)); // Install the plug-in
// Call the Cache System which is deciding wheter to continue and store the result into a cache file, or to display a cached page.
if ($TBS->PlugIn(TBS_CACHE,'testcache',10)) {
} else {
$TBS->LoadTemplate('tbs_us_examples_cache.htm');
$TBS->Show();
}
```
--------------------------------
### Initialize and Load OpenTBS Template
Source: https://www.tinybutstrong.com/forum.php?thr=3480
Demonstrates the basic setup for initializing the TinyButStrong engine, installing the OpenTBS plugin, loading an ODT template file, and triggering the download of the merged document.
```php
include_once('../../librerias/tbs_us/tbs_class.php');
include_once('../../librerias/open_tbs/tbs_plugin_opentbs.php');
$TBS = new clsTinyButStrong;
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);
$template = 'plantillas/denuncia/2Apertura.odt';
$TBS->LoadTemplate($template, OPENTBS_ALREADY_UTF8);
$filename = 'a_apertura.odt';
$TBS->Show(OPENTBS_DOWNLOAD, $filename);
```
--------------------------------
### Install HTML Plugin for TinyButStrong
Source: https://www.tinybutstrong.com/plugins.php?help=
Demonstrates how to install the HTML plugin for TinyButStrong. It can be installed automatically by including the file before TBS variable creation, or manually using a specific command if included afterward.
```php
$TBS->PlugIn(TBS_INSTALL, TBS_HTML);
```
--------------------------------
### Initialize and Render Template with TinyButStrong
Source: https://www.tinybutstrong.com/apps/examples/tbs_us_examples.php?e=prmmagnet&m=php
This PHP script initializes the TinyButStrong class, sets dynamic variables based on GET request parameters, and loads a template file for rendering. It handles conditional logic to define content fields which are then injected into the template.
```php
LoadTemplate('tbs_us_examples_prmmagnet.htm');
$TBS->Show();
```
--------------------------------
### TinyButStrong Main PHP Script Setup
Source: https://www.tinybutstrong.com/forum.php?thr=3439
Demonstrates the basic PHP setup for initializing and using TinyButStrong to load and display a main template. This includes instantiating the `clsTinyButStrong` class, loading the primary template file, and then rendering it to the output.
```php
$TBS = new clsTinyButStrong;
$TBS->LoadTemplate(THEME_URL.'/index.htm');
$TBS->Show();
```
--------------------------------
### Install TBS Plus! Plugin
Source: https://www.tinybutstrong.com/plugins/plus/doc/manual.html
This snippet shows how to install the TBS Plus! plugin. It can be installed automatically when the plugin file is included before TBS object creation, or manually using the PlugIn method if included after.
```php
$TBS->PlugIn(TBS_INSTALL, TBS_PLUS);
```
--------------------------------
### Populate DOCX Table from PHP Array with OpenTBS
Source: https://www.tinybutstrong.com/forum.php?thr=3539
This snippet shows how to create a DOCX table dynamically from a PHP array. It assumes you have the TinyButStrong and OpenTBS libraries installed. The input is a multi-dimensional PHP array, and the output is a DOCX file with the array's content structured in a table.
```php
$line0 = [0=>'cell :0,0', 1=>'cell 0,1',2=>'cell 0,2',3=>'cell 0,3'];
$line1 = [0=>'cell : 1,0 ;', 1=>'cell 1,1',2=>'cell 1,2',3=>'cell 1,3'];
$content = [
0=>$line0,
1=>$line1
];
// Assuming $TBS is an instance of clsTinyButStrong and the DOCX template has a block named 'myBlock' with a sub-block 'myRow' and a field 'myCell'.
// The actual OpenTBS merge code would go here, iterating through $content and merging into the template.
// Example structure (not the full code):
// $TBS->MergeBlock('myBlock', $content);
```
--------------------------------
### Absolute Block Syntax Example
Source: https://www.tinybutstrong.com/apps/examples/tbs_us_examples.php?e=blocks&m=source
Demonstrates the absolute syntax for defining a block using 'begin' and 'end' TBS tags. This method explicitly defines the start and end of a block.
```html
[blk1;block=begin][blk1.val]
[blk1;block=end]
```
--------------------------------
### Initialize and Display TinyButStrong Template (PHP)
Source: https://www.tinybutstrong.com/examples.php?e=-welcome&m=php
This snippet shows the fundamental steps to use TinyButStrong. It includes the class, loads a specified HTML template, and then displays the processed content. Ensure the tbs_class.php file and the HTML template are in the correct relative paths.
```php
LoadTemplate('tbs_us_examples__welcome.htm');
$TBS->Show();
```
--------------------------------
### Local File Path Examples in TinyButStrong
Source: https://www.tinybutstrong.com/forum.php?thr=3073
Provides examples of using local file paths within TinyButStrong. It shows that relative paths like './js/' are functional, while absolute paths starting with '/' might require specific server configurations or might not be interpreted as intended by TinyButStrong in certain contexts.
```tinybutstrong
./js/
```
```tinybutstrong
/js
```
--------------------------------
### Initialize TinyButStrong with OpenTBS
Source: https://www.tinybutstrong.com/plugins/opentbs/tbs_plugin_opentbs.html
Demonstrates how to include the necessary files and install the OpenTBS plugin into the TinyButStrong engine.
```php
include_once('tbs_class.php');
include_once('tbs_plugin_opentbs.php');
$TBS = new clsTinyButStrong;
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);
```
```php
$TBS = new clsTinyButStrong;
$TBS->Plugin(TBS_INSTALL, 'clsOpenTBS');
```
--------------------------------
### Load and Show Template with TinyButStrong (PHP)
Source: https://www.tinybutstrong.com/apps/examples/tbs_us_examples.php?e=hello&m=php
This snippet initializes TinyButStrong, loads an HTML template ('tbs_us_examples_hello.htm'), and displays it. It requires the TinyButStrong class to be included. The primary output is the rendered HTML content of the template.
```php
LoadTemplate('tbs_us_examples_hello.htm');
$TBS->Show();
```
--------------------------------
### PHP: Load and Display TinyButStrong Template with Subtpl
Source: https://www.tinybutstrong.com/examples.php?e=subtpl&m=php
This PHP script initializes TinyButStrong, loads a main template, and displays it. It handles a GET parameter 'art' to dynamically select an article template and also includes logic to show the source of a sub-template if requested via 'subsrc' GET parameter. Dependencies include the TinyButStrong class and HTML template files.
```php
LoadTemplate('tbs_us_examples_subtpl.htm');
$TBS->Show();
?>
```
--------------------------------
### Implement Simple and Complex DOCX Fields
Source: https://www.tinybutstrong.com/plugins/opentbs/xml_synopsis.html
Provides examples of both simple fields (w:fldSimple) and complex fields (w:fldChar) which require start, separator, and end markers to define logic like IF statements.
```XML
Marcel Proust IF 0 = 1 "Test is true." "Test is false." \* MERGEFORMAT Test is false.
```
--------------------------------
### Initialize OpenTBS and Aggregate Plugins
Source: https://www.tinybutstrong.com/forum.php?thr=3449
Setup script for integrating TinyButStrong, OpenTBS, and the Aggregate plugin in a PHP environment.
```php
include_once('tbs/tbs_us/tbs_class.php');
include_once('tbs/tbs_plugin_opentbs/tbs_plugin_opentbs.php');
include_once('tbs/tbs_plugin_aggregate/tbs_plugin_aggregate.php');
$TBS = new clsTinyButStrong;
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);
```
--------------------------------
### Initialize and Configure TBS Cache Plugin
Source: https://www.tinybutstrong.com/plugins.php?help=
Demonstrates how to include the plugin and perform basic initialization or manual installation to set custom directories and file masks.
```PHP
include_once('tbs_plugin_cache.php');
$TBS->PlugIn(TBS_CACHE, 'mainpage', 3600);
// Manual installation with custom directory and mask
$TBS->PlugIn(TBS_INSTALL, TBS_CACHE, './temp', 'my_cache_*.php');
```
--------------------------------
### PHP: Merge Data into HTML Template with TinyButStrong
Source: https://www.tinybutstrong.com/examples.php?e=prmmagnet&m=php
This PHP script utilizes the TinyButStrong library to load an HTML template and merge dynamic data into it. It handles conditional data population based on a GET parameter, allowing for demonstration of empty field handling.
```php
LoadTemplate('tbs_us_examples_prmmagnet.htm');
$TBS->Show();
```
--------------------------------
### Initialize and Render TBS Template
Source: https://www.tinybutstrong.com/apps/examples/tbs_us_examples.php?e=prmope&m=php
This snippet demonstrates how to include the TBS class, instantiate the engine, load a specific template file, and trigger the output. It assumes the existence of 'tbs_class.php' and a corresponding HTML template file.
```php
LoadTemplate('tbs_us_examples_prmope.htm');
$TBS->Show();
?>
```
--------------------------------
### Load Template and Show Content with TinyButStrong (PHP)
Source: https://www.tinybutstrong.com/apps/examples/tbs_us_examples.php?e=cond&m=php
This PHP script initializes TinyButStrong, loads an HTML template, and displays the content. It utilizes the HTML plugin for enhanced functionality and handles a 'blk_id' GET parameter to potentially control content rendering.
```php
LoadTemplate('tbs_us_examples_cond.htm');
$TBS->Show();
```
--------------------------------
### Initialize and Download OpenTBS Document
Source: https://www.tinybutstrong.com/forum.php?thr=3069
Demonstrates how to instantiate the TinyButStrong class, install the OpenTBS plugin, load an ODT template, and trigger a file download.
```php
$TBS2 = new clsTinyButStrong;
$TBS2->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);
$TBS2->LoadTemplate('doc_template.odt', OPENTBS_ALREADY_UTF8);
$TBS2->Show(OPENTBS_DOWNLOAD, $filename);
```
--------------------------------
### Basic TinyButStrong PHP Template Merging Example
Source: https://www.tinybutstrong.com/forum.php?thr=2989
This snippet demonstrates the core functionality of TinyButStrong (TBS) in PHP. It loads an HTML template, defines a variable, merges it into the template, and displays the final output. Ensure the 'tbs_class_php5.php' file is in the same directory or accessible via include_path.
```html
[onshow.message]
```
```php
LoadTemplate('template.htm');
$message = 'Hello';
$TBS->Show();
?>
```
--------------------------------
### Initialize and Render TinyButStrong Template
Source: https://www.tinybutstrong.com/examples.php?e=prmfrm&m=php
This script demonstrates how to include the TinyButStrong library, define variables for template placeholders, and trigger the rendering process. It requires the tbs_class.php file and a corresponding tbs_us_examples_prmfrm.htm template file to function correctly.
```php
LoadTemplate('tbs_us_examples_prmfrm.htm');
$TBS->Show();
```
--------------------------------
### Initialize and Render TinyButStrong Template
Source: https://www.tinybutstrong.com/apps/examples/tbs_us_examples.php?e=prmenlarge&m=php
This script initializes the TinyButStrong engine, loads a specified HTML template file, and renders the output to the browser. It requires the tbs_class.php library to be present in the parent directory.
```php
LoadTemplate('tbs_us_examples_prmenlarge.htm');
$TBS->Show();
```
--------------------------------
### Load and Show Template with TinyButStrong (PHP)
Source: https://www.tinybutstrong.com/examples.php?e=prmenlarge&m=php
This snippet shows how to initialize the TinyButStrong class, load an HTML template, and then display the processed template. It requires the 'tbs_class.php' file and an HTML template file (e.g., 'tbs_us_examples_prmenlarge.htm').
```php
LoadTemplate('tbs_us_examples_prmenlarge.htm');
$TBS->Show();
```
--------------------------------
### Initialize OpenTBS Plugin
Source: https://www.tinybutstrong.com/forum.php?thr=3293
Initializes the OpenTBS plugin within the TinyButStrong instance.
```php
$this->TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);
```
--------------------------------
### Load Template and Show with TinyButStrong (PHP)
Source: https://www.tinybutstrong.com/examples.php?e=cond&m=php
This PHP code initializes TinyButStrong, loads an HTML template, and displays the merged output. It includes necessary includes for the TinyButStrong class and its HTML plugin. It also handles a 'blk_id' GET parameter to potentially control conditional merging within the template.
```php
LoadTemplate('tbs_us_examples_cond.htm');
$TBS->Show();
```
--------------------------------
### Initialize and Render TinyButStrong Template
Source: https://www.tinybutstrong.com/examples.php?e=prmope&m=php
This snippet demonstrates how to include the TinyButStrong library, instantiate the class, load a template file, and render the final output. It assumes the existence of 'tbs_class.php' and a corresponding HTML template file.
```php
LoadTemplate('tbs_us_examples_prmope.htm');
$TBS->Show();
```
--------------------------------
### PHP: TinyButStrong Data Merging and Parameter Selection
Source: https://www.tinybutstrong.com/examples.php?e=prmsel&m=php
This snippet shows how to use TinyButStrong in PHP to load data from an array and merge it with an HTML template. It includes the setup of data arrays, instantiation of the TinyButStrong class, loading a template, merging blocks of data, and displaying the result. Dependencies include the TinyButStrong class and the 'html' plugin.
```php
'Red','id'=>1);
$item_lst[] = array('name'=>'Green' ,'id'=>2);
$item_lst[] = array('name'=>'Blue' ,'id'=>3);
$item_lst[] = array('name'=>'Yellow','id'=>4);
$item_lst[] = array('name'=>'White','id'=>5);
$sel1_name = 'Yellow';
$sel1_id = 4;
$sel2_name = array('Green','Blue','Yellow');
$sel2_id = array(2,3,4);
$TBS = new clsTinyButStrong;
$TBS->LoadTemplate('tbs_us_examples_prmsel.htm');
// List feeding
$TBS->MergeBlock('lst1v',$item_lst);
$TBS->MergeBlock('lst1' ,$item_lst);
$TBS->MergeBlock('lst3v',$item_lst);
$TBS->MergeBlock('lst3' ,$item_lst);
// The selection of the items is done here
$TBS->Show();
```
--------------------------------
### OpenTBS Show() Method: Download with No Header
Source: https://www.tinybutstrong.com/forum.php?thr=3387
Demonstrates how to render a merged archive as an HTTP download without custom headers using OpenTBS. This requires combining OPENTBS_DOWNLOAD and OPENTBS_NOHEADER flags.
```php
$TBS->Show(OPENTBS_DOWNLOAD + OPENTBS_NOHEADER);
```
--------------------------------
### PHP: Install TinyButStrong Excel Plug-in Manually
Source: https://www.tinybutstrong.com/plugins/excel/tbs_plugin_excel.htm
This snippet shows the manual installation method for the TinyButStrong Excel plug-in. The plug-in must be installed before the LoadTemplate() method is called to ensure proper functionality.
```php
$TBS->PlugIn(TBS_INSTALL,TBS_EXCEL);
```
--------------------------------
### Initialize and Render TinyButStrong Template
Source: https://www.tinybutstrong.com/apps/examples/tbs_us_examples.php?e=var&m=php
This script demonstrates the standard workflow for TinyButStrong: including the class file, preparing data variables, loading a template, and outputting the result. It shows how to pass simple variables, arrays, and objects to the template engine.
```php
';
class clsObj {
var $param = 'hello';
}
$obj = new clsObj;
$TBS = new clsTinyButStrong;
$TBS->LoadTemplate('tbs_us_examples_var.htm');
$TBS->Show();
```
--------------------------------
### TinyButStrong Magnet Tag Examples
Source: https://www.tinybutstrong.com/examples.php?e=prmmagnet&m=source
Illustrates various TinyButStrong magnet tag configurations within an HTML structure. These examples show how to conditionally display HTML elements like links, images, and line breaks based on the 'magnet' and 'mtype' parameters.
```html
TinyButStrong - Example of magnet tags
Example of magnet tags
this TBS template is W3C compliant
A Magnet tag is an Html tag linked to a TBS field. The Magnet tag is deleted when the field is deleted, i.e. when the field is null or empty string. A Magnet tag is defined using parameter magnet. The type of the tag (single or opening-closing) and its position are defined using parameter mtype.
```
--------------------------------
### Implement NavBar in HTML Templates
Source: https://www.tinybutstrong.com/plugins.php?help=
Demonstrates the use of TBS block syntax to render pagination links. Includes examples of using field parameters like 'endpoint' and 'magnet' to conditionally display navigation elements.
```HTML
Beginning
[nav.page;block=td]
[nav.page;block=td;currpage]
```
--------------------------------
### Block Without Definition Example
Source: https://www.tinybutstrong.com/apps/examples/tbs_us_examples.php?e=blocks&m=source
Explains the behavior when a block definition is omitted. In this case, only the first record of the block is merged.
```html
Example: [blk7.val]
```
--------------------------------
### HTML Structure for Dynamic Columns Example
Source: https://www.tinybutstrong.com/apps/examples/tbs_us_examples.php?e=dyncol0&m=source
This HTML code sets up the structure for a dynamic column example using TinyButStrong. It includes a form for user input (number of rows and columns) and a table that will be populated dynamically. The CSS styles define cell colors for visual distinction.
```html
TinyButStrong - Example of dynamic columns
Example of dynamic columns
this TBS template is W3C compliant
This is an old way to perform dynamic columns with TinyButStrong. Please note that since TBS vresion 3.9.0, you can perform the same feature using parameter parallel. In the current solution, there is no need of any specific parameter. You first have to merge colmuns before rows in order to have expanded columns on every futur rows. Then you have to merge rows.
In this example, the script creates a multiplication table with alternated row's color. You can change the number of columns and rows.
X
[c0.key;block=td]
[r.$;block=tr]
[r.[c1.val;block=td]]
[r.$;block=tr]
[r.[c2.val;block=td]]
```
--------------------------------
### PHP OpenTBS Mailmerge and Download
Source: https://www.tinybutstrong.com/forum.php?thr=2415
This snippet demonstrates how to initialize OpenTBS, load a DOCX template, merge data from a MySQL query into blocks, and then download the generated DOCX file. It includes necessary includes for the OpenTBS class and plugin.
```php
include_once("../../common.php");
include('tbs_class_php5.php');
include('tbs_plugin_opentbs.php');
$TBS = new clsTinyButStrong; // new instance of TBS
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN); // load OpenTBS plugin
$parth="/srv/schoolwebmergeletters/$owner";
//$TBS->LoadTemplate("$parth/sit_commendation_sample.docx");
$TBS->LoadTemplate("$parth/$thedoc");
//$data = $TBS->MergeBlock('m,*', 'mysql', "SELECT * FROM 2009_rosshill_students order by surname LIMIT 3");
$thesql=urldecode($thesql);
$data = $TBS->MergeBlock('m,*', 'mysql', $thesql);
$TBS->MergeBlock('m', $data);
$file_name = 'students_'.date('Y-m-d_H-i-s').'.docx';
$TBS->Show(OPENTBS_DOWNLOAD+TBS_EXIT, $file_name);
```
--------------------------------
### Load and Show TinyButStrong Template in PHP
Source: https://www.tinybutstrong.com/apps/examples/tbs_us_examples.php?e=prmfrm&m=php
This snippet demonstrates how to instantiate the TinyButStrong class, load an HTML template, and then display the processed template. It requires the 'tbs_class.php' file and an HTML template file.
```php
LoadTemplate('tbs_us_examples_prmfrm.htm');
$TBS->Show();
```
--------------------------------
### TinyButStrong mergeblock() Syntax Examples
Source: https://www.tinybutstrong.com/forum.php?thr=3478
Demonstrates different syntaxes for the mergeblock() function in TinyButStrong. Example 1 shows a direct array merge, while Example 2 and 3 illustrate attempts to merge arrays with specific filtering or nested structures, which can lead to issues with larger or more complex documents.
```php
mergeblock('namevar', $array);
mergeblock('namevar', 'Array', 'arraynamevar');
mergeblock('namevar', 'Array', 'arraylvl1[%p1%][arraylvl2][%P2%][arraylvl3]');
```
--------------------------------
### OpenTBS Show() Method: Output with Custom Headers
Source: https://www.tinybutstrong.com/forum.php?thr=3387
Shows how to render a merged archive as an HTTP output with custom headers defined prior to the call. This uses the OPENTBS_NOHEADER flag, but requires OPENTBS_DOWNLOAD to be set.
```php
header(...); // your custom headers here
$TBS->Show(OPENTBS_NOHEADER);
```
--------------------------------
### No Block Definition Example
Source: https://www.tinybutstrong.com/examples.php?e=blocks&m=source
Demonstrates the behavior of TinyButStrong when a block definition is omitted. In this case, only the first record of the data is merged into the template.
```html
Example: [blk7.val]
```
--------------------------------
### Initialize TBS NavBar Plugin
Source: https://www.tinybutstrong.com/plugins.php?help=
Sets up a navigation bar for pagination by calling the PlugIn method with the TBS_NAVBAR constant. It accepts parameters for navigation name, display options, current page, total records, and page size.
```PHP
$TBS->PlugIn(TBS_NAVBAR,'nav','',$page,$rec_nbr,$page_size);
```
--------------------------------
### Encapsulation Block Syntax Example
Source: https://www.tinybutstrong.com/apps/examples/tbs_us_examples.php?e=blocks&m=source
Shows how to define a block on a higher-level HTML tag using encapsulation with parentheses. This allows blocks to be bounded by parent elements.
```html
[blk6.val;block=((tr))]
```
--------------------------------
### Multilanguage Support: HTML Field Examples
Source: https://www.tinybutstrong.com/forum.php?thr=629
These HTML snippets illustrate how to integrate multilingual content using TinyButStrong. The first example `[ml.id_title]` shows how to merge text retrieved by an ID using a user function. The second example `[ml;text='hello world']` demonstrates embedding text directly within the field, which is then processed by a user function.
```HTML
[ml.id_title]
```
```HTML
[ml;text='hello world']
```
```HTML
[lang.WELCOME]
```
--------------------------------
### OpenTBS Show() Method: Download with Custom Headers
Source: https://www.tinybutstrong.com/forum.php?thr=3387
Illustrates rendering a merged archive as an HTTP download with a specified filename using OpenTBS. This uses the OPENTBS_DOWNLOAD flag.
```php
$TBS->Show(OPENTBS_DOWNLOAD, $file_name);
```
--------------------------------
### TBS htmlconv=esc Example
Source: https://www.tinybutstrong.com/forum.php?thr=296
Illustrates the use of the 'htmlconv=esc' parameter in TBS, which is intended for HTML escaping. The example shows that this method does not produce the desired JavaScript-compatible escaping for single quotes.
```javascript
PHP
| $test = "lalala'djskj";
---
Template:
alert ('{var.test;htmlconv=esc}');
---
Result in Javascript:
alert ('lalala\'\'djskj');
```
--------------------------------
### Load and Display HTML Template with TinyButStrong (PHP)
Source: https://www.tinybutstrong.com/apps/examples/tbs_us_examples.php?e=script&m=php
This script initializes the TinyButStrong class, loads an HTML template file ('tbs_us_examples_script.htm'), and then displays the processed content. It requires the TinyButStrong library to be included.
```php
LoadTemplate('tbs_us_examples_script.htm');
$TBS->Show();
```
--------------------------------
### PHP: TinyButStrong with By-Page and Navbar Plugins
Source: https://www.tinybutstrong.com/apps/examples/tbs_us_examples.php?e=page&m=php
This PHP script initializes TinyButStrong, loads a template, and applies the By-Page and Navbar plugins for data pagination. It prepares an array of product data and merges it into the template, enabling dynamic page navigation. Dependencies include the TinyButStrong class and its associated plugins.
```php
'Tuba' , 'price'=>100.00);
$data[] = array('product'=>'Trumpet' , 'price'=>112.50);
$data[] = array('product'=>'Trombone' , 'price'=>169.00);
$data[] = array('product'=>'Banjo' , 'price'=>119.00);
$data[] = array('product'=>'Cymbals' , 'price'=>67.00);
$data[] = array('product'=>'Drums' , 'price'=>269.95);
$data[] = array('product'=>'Flute' , 'price'=>39.95);
$data[] = array('product'=>'Saxophone' , 'price'=>760.00);
$data[] = array('product'=>'Piano' , 'price'=>10995.00);
$data[] = array('product'=>'Organ' , 'price'=>700.00);
$data[] = array('product'=>'Clarinet' , 'price'=>56.00);
$data[] = array('product'=>'Guitar' , 'price'=>215.00);
$data[] = array('product'=>'Harmonica' , 'price'=>5.99);
$data[] = array('product'=>'Bass' , 'price'=>189.00);
$data[] = array('product'=>'Harp' , 'price'=>199.00);
$data[] = array('product'=>'Violin' , 'price'=>64.95);
$data[] = array('product'=>'Bagpipes' , 'price'=>129.00);
$data[] = array('product'=>'Ukulele' , 'price'=>48.00);
// Default value
if (!isset($_GET)) $_GET=&$HTTP_GET_VARS;
if (isset($_GET['PageNum'])) {
$PageNum = $_GET['PageNum'];
} else {
$PageNum = 1;
}
// Default value
if (isset($_GET['RecCnt'])) {
$RecCnt = intval($_GET['RecCnt']);
} else {
$RecCnt = -1;
}
$PageSize = 5;
$TBS = new clsTinyButStrong;
$TBS->LoadTemplate('tbs_us_examples_page.htm');
// Merge the block by page
$TBS->PlugIn(TBS_BYPAGE,$PageSize,$PageNum,$RecCnt); // Next block will be merged suing By-Page mode.
$RecCnt = $TBS->MergeBlock('blk',$data);
// Merge the Navigation Bar
$TBS->PlugIn(TBS_NAVBAR,'nv','',$PageNum,$RecCnt,$PageSize);
$TBS->Show();
```
--------------------------------
### Text Line Block Syntax Example
Source: https://www.tinybutstrong.com/examples.php?e=blocks&m=source
Demonstrates defining a TinyButStrong block on a simple text line using the underscore '_' symbol. This method is independent of HTML tags.
```html
[blk4.val;block=_]
```
--------------------------------
### Numeric Formatting Examples in TinyButStrong
Source: https://www.tinybutstrong.com/manual.php
Demonstrates various numeric formatting options in TinyButStrong using the 'frm' parameter. This includes specifying decimal separators, thousand separators, leading zeros, and percentage multiplication. The examples show how different format strings affect the displayed output for given values.
```text
[fld;frm='0.000']
[fld;frm='$ 0,000.00']
[fld;frm='$ 0,000.']
[fld;frm='000000.']
[fld;frm='0.00 %']
[fld;frm='coef 0.00']
```
--------------------------------
### Simplified Block Syntax Example
Source: https://www.tinybutstrong.com/apps/examples/tbs_us_examples.php?e=blocks&m=source
Shows the simplified syntax where the block definition is included directly within a TBS field. This offers a more concise way to define blocks.
```html
[blk3.val;block=tr]
```
--------------------------------
### Relative Block Syntax Example
Source: https://www.tinybutstrong.com/apps/examples/tbs_us_examples.php?e=blocks&m=source
Illustrates the relative syntax where a block is defined by a single TBS tag, relative to surrounding HTML tags. This simplifies block definition.
```html
[blk2.val][blk2;block=tr]
```
--------------------------------
### Usage Examples for Dibi with TinyButStrong
Source: https://www.tinybutstrong.com/forum.php?thr=3204
Demonstrates how to use the Dibi plugin with the MergeBlock method, covering basic SQL queries, parameterized queries, and passing existing Dibi recordsets.
```PHP
// basic
$TBS->MergeBlock('myblock', 'DIBI', "SELECT c1, c2, c3 FROM table1");
// with an extra Dibi parameter
$TBS->MergeBlock('myblock', 'DIBI', "SELECT c1, c2, c3 FROM table1 WHERE c4 = %1", $id);
// with a Dibi Recordset
$rs = dibi::query($sql);
$TBS->MergeBlock('myblock', 'DIBI',$rs);
```
--------------------------------
### Text Line Block Syntax Example
Source: https://www.tinybutstrong.com/apps/examples/tbs_us_examples.php?e=blocks&m=source
Demonstrates defining a block on a simple text line using the '_' symbol, independent of HTML tags. This is useful for plain text content.
```html
[blk4.val;block=_]
```
--------------------------------
### Initialize and Merge TBS Block with Export Plugin
Source: https://www.tinybutstrong.com/plugins/export/documentation.html
Demonstrates the PHP implementation for loading the TBS engine and the Export plugin, merging data into a block, and rendering the template. This setup prepares the template to utilize the export functionality for block fields.
```PHP
include 'tbs_class.php';
include 'tbs_plugin_export.php';
$TBS = new clsTinyButStrong;
$TBS->LoadTemplate('my_template.tpl');
$data = Array
(
Array('name' => 'John', 'age' => '24'),
Array('name' => 'Bob', 'age' => '35'),
Array('name' => 'Jordan', 'age' => '14')
);
$TBS->MergeBlock('blk_test', $data);
$TBS->Show();
```
--------------------------------
### Install MergeOnFly Plugin for TinyButStrong
Source: https://www.tinybutstrong.com/plugins.php?help=
Explains how to activate the MergeOnFly plugin for TinyButStrong. This plugin enables the MergeBlock() method to display data progressively. It can be installed automatically on first use or manually.
```php
$TBS->PlugIn(TBS_ONFLY, PackSize [, boolean CountSubRecord=false]);
```