.. You may want to use the usual include line. Uncomment and adjust the path. .. include:: ../Includes.txt ============================= 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: EXT: Backend templates system ============================= Extension Key: **gl\_be\_templates** Copyright 2000-2002, Miriam Pena Villanueva, 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: 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: Introduction ------------ .. _What-does-it-do: 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: Users manual ------------ There are two elements for these templates: - Blocks: :: Block content ... - Variables (between '{' and '}'): :: {var_name} .. _generated: ((generated)) ^^^^^^^^^^^^^ .. _generated: ((generated)) """"""""""""" .. _Example: Example ~~~~~~~ Template file **typo3conf/ext/my\_ext/templates/example.tmpl** : :: {rows}
{header1} {header2}
{column1} {column2} 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: Known problems -------------- None at the time. Just contact me if you find some. .. _To-Do-list: To-Do list ---------- Please contact me if you have any suggestion about this extension. .. _Changelog: Changelog --------- 0.1.0: First public release. |img-1| EXT: Backend templates system - 3 .. ######CUTTER_MARK_IMAGES###### .. |img-1| image:: img-1.png .. :align: left .. :border: 0 .. :height: 32 .. :id: Graphic1 .. :name: Graphic1 .. :width: 102