This module allows to include dynamic content in Drupal pages using the TinyButStrong Template Engine.
The possibilities of dynamic content are very rich. For example, it can be listing data from MySQL tables, or it can complete user interface asking and processing data given by the user.
TinyButStrong is very well adapted for CMS because, unlike other Template Engines, it allows to have templates build with visual or WYSIWYG editors. It means that a template can be a Joomla article build with the inline Html editor provide by default (TinyMCE).
Extract the archive of the module into your Drupal installation (normally into sites/all/modules).
Then enable the module in Administer > Site building > Modules.
You can eventually configure the module behavior in Home › Administer › Site configuration › TinyButStrong.
Since the module is installed and activated in the Drupal website, a new Input Format is available when you create or edit a content (a Page, a Story, or other custom content type). The new format is named "Dynamic content with TinyButStrong Template Engine". When this format is choosen in the content parameters, then you can use 2 types of TBS tags (see below) that you can put in the content's body which will be found an processed by TinyButStrong.
Because dynamic content can be dangeroulsy powerfull, by default only the Administrator has permission to apply this Input Format to a content and to edit a content that has this Input Format.
You can change this security level at you own risk. Permissions about Input Formats can be changed in Administer > Site configuration > Input Formats.
Please note:
This help file assumes that you understand the basic concepts of Template Engines and more specifically the TinyButStrong Template Engine.
Syntax:
{tbs}mergeblock=blockname;db=dbname;sql=sqlstatement{/tbs}
This type of plugin tag takes the current article as current template and performs a TBS->MergeBlock() over it.
The result of the merging is displayed instead of the original article.
There is no need to code any PHP to use this type of plugin tag.
blockname: | Name of the TBS block to merge. Assuming that such a block exists in the current article. |
dbname: | Optional. Name of the database where to use the SQL statement. The database must be available with the current Joomla connection. You can specify the keyword %current% for the Joomla database. If you want to connect to a database with another account and password, you must use another type of plugin tag because this one cannot do it. |
sqlstatement: | The SQL statement that should return the data to display. Since version 1.02 of this plugin: In order to facilitate the usage of operators '<' and '>' in the SQL statement, the plugin automatically replaces strings '-+' and '+-' with those operators. You can prevent this behavior by adding the parameter sql_preserve in the plugin tag. Example: {tbs}mergeblock=u;sql=SELECT name FROM users WHERE uid+-0{/tbs} is the same as {tbs}mergeblock=u;sql=SELECT name FROM users WHERE uid>0;sql_preserve{/tbs} |
scriptname.php: | The PHP script to run. You can specify a path. The default path for all scripts can also be specified in the plug-in parameters. |
dbname: | Optional. Name of the database to select before the script is run. The database must be available with the current Joomla connection. You can specify the keyword %current% for the Drupal database. If you want to connect to a database with another account and password, then your script must open this connection by itself, and you should specify explicitly the new open connected for any use of MergeBlock(). |
Moreover, the module gives to you other coding facilities:
Two functions are given by the TinyButStrong plug-in to work with the Drupal database connectivity. It helps to query and execute SQL statements in the Drupal database and other databases available with the same MySQL connection as Drupal.
Tips and trics using the Drupal framework:
How to get | Code | Comments | ||
Current Node's id: | (na) | Not possible because this plug-in is a Drupal Filter and can be applied on a text string which may be a combination of contents. | ||
Database connection | global $active_db; | a MySQLi object. | ||
User information: | global $user; | an array of information |
You can found more coding ressource at the Drupal API Reference
Verion 1.5.0-beta: first version