.. You may want to use the usual include line. Uncomment and adjust the path. .. include:: ../Includes.txt ========================= EXT: Photogallery express ========================= :Author: Kasper Skårhøj :Created: 2002-11-01T00:32:00 :Changed: 2006-08-31T10:22:43 :Author: Patrick Kapar :Email: info@patie.nl :Info 3: :Info 4: .. _EXT-XTemplate-for-Typo3: EXT : XTemplate for Typo3 ========================= Extension Key: **xtemplate** Copyright 2006, Fabien Udriot, 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 : Xtemplate for Typo3 1** **Introduction 1** What does it do? 1 **Examples 2** A simple example 1 2 A simple example 2 2 Further documentation 3 **Knows Problems 3** **Todo List 3** **Changed Log 3** .. _Introduction: Introduction ------------ .. _What-does-it-do: What does it do? ^^^^^^^^^^^^^^^^ XTemplate is a simple and very powerful template engine. It is used in many large scaled projects and in many open source CMSs. It has proven its scalability and its stability. XTemplate is similar to Smarty (Maybe you have heard about it...). The template syntax is very close and the separation between PHP and HTML is well implemented rendering it very userfriendly. Though Smartly is certainly one of the richest template engines, it is also quite fat... Smarty has over 3000 lines of code to include each time ! For my typo3 extension needs, it is simply an overkill ! Furthermore, I was not satisfied with the Typo3 template engine. The tslib\_cObj class wich provides all the necessary functions is quite complicated to use, particularly with complex templates (loop of a loop...). I find also the separation between HTML and PHP not as evident as other template engine... In regard of this, I decided to use XTemplate for my frontend plugins development as main template engine. As mentioned above, XTemplate is designed to be very fast in template processing... Although it's introduce a dependency to my extension, my code looks much cleaner and shorter. The maintainability level is simply better... To make it work, I have slightly changed a few lines in the XTemplate class in order to integrate it in Typo3. How does it function ? You will find in the next paragraph a simple example... .. _Examples: Examples -------- .. _A-simple-example-1: A simple example 1 : ^^^^^^^^^^^^^^^^^^^^ .. _HTML-code: HTML code : """"""""""" {HELLO\_WORLD}
.. _PHP-code: PHP code : """""""""" // instantiate the object $xtpl = new tx\_xtemplate('file.xtpl'); // simple replace $xtpl->assign('HELLO\_WORLD', 'Hello World !'); // simple replace $xtpl->parse('block1'); // display the content $output = $xtpl->out('block1'); echo $output; .. _A-simple-example-2: A simple example 2 : ^^^^^^^^^^^^^^^^^^^^ .. _HTML-code: HTML code : """""""""""
Say hello : {DATA}
.. _PHP-code: PHP code : """""""""" // instantiate the object $xtpl = new tx\_xtemplate('file.xtpl'); // loop replacement $sayHello = array('hello','bonjour','guten Tag','buenas dias'); foreach($sayHello as $hello){ $xtpl->assign('DATA', $hello); $xtpl->parse('block2'); } // display the content $output = $xtpl->out('block1'); echo $output; .. _Further-documentation: Further documentation ^^^^^^^^^^^^^^^^^^^^^ It's not the purpose to explain here how XTemplate works in detail. XTemplate has a very good documentation. If you are interested to play with XTemplate and use it in you extensions, I recommend you read: - the 7 basic examples here : `http://www.phpxtemplate.org/DocumentationBasics `_ - have a look of this extension : eco\_gal .. _Known-problems: Known problems -------------- Post in the feed-back section on typo3.org/extensions/ ... .. _To-Do-list: To-Do list ---------- Post in the feed-back section on typo3.org/extensions/ ... .. _Changelog: Changelog --------- \- 1.7: first release, corresponds to the XTemplate version. |img-1| EXT: Photogallery express - 3 .. ######CUTTER_MARK_IMAGES###### .. |img-1| image:: img-1.png .. :align: left .. :border: 0 .. :height: 32 .. :id: Graphic1 .. :name: Graphic1 .. :width: 102