DEPRECATION WARNING
This documentation is not using the current rendering mechanism and is probably outdated. The extension maintainer should switch to the new system. Details on how to use the rendering mechanism can be found here.
EXT: Backend templates system¶
Author: | Kasper Skårhøj |
---|---|
Created: | 2002-11-01T00:32:00 |
Changed by: | Manuel Rego |
Changed: | 2007-08-06T11:04:53 |
Author: | Miriam Pena Villanueva |
Email: | mpena@igalia.com |
Info 3: | |
Info 4: |
EXT: Backend templates system¶
Extension Key: gl_be_templates
Copyright 2000-2002, Miriam Pena Villanueva, <mpena@igalia.com>
This document is published under the Open Content License
available from http://www.opencontent.org/opl.shtml
The content of this document is related to TYPO3
- a GNU/GPL CMS/Framework available from www.typo3.com
Table of Contents¶
EXT: gl_be_templates 1
Introduction 1
What does it do? 1
Users manual 1
Known problems 2
To-Do list 3
Changelog 3
Introduction¶
What does it do?¶
This extension is used to separate the logic from the HTML code.
Integrates Kristian Koehntopp template management system to be used in backend modules of Typo3. For more information see http://phplib.sourceforge.net/ and http://phplib.sourceforge.net/ .
Users manual¶
There are two elements for these templates:
Blocks:
<!-- BEGIN block_name --> <strong>Block content</strong> ... <!-- END block_name -->
Variables (between '{' and '}'):
<strong>{var_name}</strong>
((generated))¶
((generated))¶
Example¶
Template file typo3conf/ext/my_ext/templates/example.tmpl :
<!-- BEGIN table -->
<table>
<tr>
<td><strong>{header1}</strong></td>
<td><strong>{header2}</strong></td>
</tr>
{rows}
</table>
<!-- END table -->
<!-- BEGIN row -->
<tr>
<td>{column1}</td>
<td>{column2}</td>
</tr>
<!-- END row -->
Creates an instance of tx_template_util class:
$tpl = t3lib_div::makeInstance("tx_template_util");
Set the root directory for the templates file:
$tpl->set_root(t3lib_extMgm::extPath('my_ext'));
Set the template file:
$tpl->set_file(array('body' => 'templates/example.tmpl'));
Set the templates blocks:
$tpl->set_block('body','table');
$tpl->set_block('body','row');
Loop to generates the rows:
$rows = @$GLOBALS['TYPO3_DB']->exec_SELECTgetRows('uid, title', 'tt_news', '');
foreach ($rows as $row) {
Set the variables:
$tpl->set_var('column1', $row['uid']);
$tpl->set_var('column1', $row['title']);
Parse the rows (attention to the third param TRUE , if true the value is appended to the variable's existing value):
$tpl->parse('rows','row',true);
Close the loop:
}
Set the variables for the heading:
$tpl->set_var('header1', 'UID');
$tpl->set_var('header2', 'Title');
Parse the main block:
$tpl->parse('out', 'table');
Get the result:
$content = $tpl->get('out', 'table');
For more information about the class tx_template_util see the source code comments.
Known problems¶
None at the time. Just contact me if you find some.
To-Do list¶
Please contact me if you have any suggestion about this extension.