Documentation Menu

1.5 Template Project

The Joomla! Documentation Working Group is running a project to develop detailed reference and tutorial material on Joomla! 1.5 templates.  There is a project page on the documentation wiki where you can see the work in progress and help us by contributing your knowledge.

Who's Online

We have 5 guests online

Help Site License

The Joomla! Help Site content is copyright © 2005 - 2008 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution NonCommercial ShareAlike 2.5. Some parts of this website may be subject to other licenses.
Home arrow Manual arrow 4. Mambots arrow Extending Mambots

Extending Mambots PDF Print E-mail
Mambots and Mambot groups can be used for a variety of purposes. For example, suppose you want to include an HTML Templating system like patTemplate (www.php-tools.de) and load it in your custom components that use it. Here's a rough outline of the steps that you would take to set this up.
  1. Create a directory called "patTemplate" under the /mambots directory.
  2. Unpack the patTemplate distribution file such that patTemplate.php is in the new directory you created. All the patTemplate support files should be in 'another' patTemplate directory. Note that you will also need to include patError.php and patErrorManager.php in this directory. The /mambots/patTemplate directory should now look something like this:
    /mambots
      /patTemplate
        patTemplate.php
        patError.php
        patErrorManager.php
        /patTemplate (many files provided under this directory)
  3. Create an XML setup file for the Mambot listing all the files under the /mambot/patTemplate directory. It might look something like this:
    <?xml version="1.0" encoding="iso-8859-1"?>
    <mosinstall type="mambot" group="patTemplate" version="4.5.1">
      <name>patTemplate</name>
      <creationDate>01/09/2004</creationDate>
      <version>3.0 Beta 1</version>
      <author>Stephan Schmidt</author>
      <license>http://www.gnu.org/copyleft/lgpl.html GNU/LGPL</license>
      <authorEmail>schst@php.net</authorEmail>
      <authorUrl>www.php-tool.de</authorUrl>
      <description>Powerful templating engine</description>
      <files>
        <filename>patError.php</filename>
        <filename>patErrorManager.php</filename>
        <filename>patTemplate/Dump/Html.php</filename>
        <filename>patTemplate/Dump.php</filename>
        <filename>patTemplate/Function/Time.php</filename>
        <filename>patTemplate/Function.php</filename>
        <filename>patTemplate/InputFilter/StripComments.php</filename>
        <filename>patTemplate/InputFilter.php</filename>
        <filename>patTemplate/Modifier/HTML/Img.php</filename>
        <filename>patTemplate/Modifier/Wordwrapper.php</filename>
        <filename>patTemplate/Modifier.php</filename>
        <filename>patTemplate/Module.php</filename>
        <filename>patTemplate/OutputCache.php</filename>
        <filename>patTemplate/OutputFilter/Gzip.php</filename>
        <filename>patTemplate/OutputFilter/StripWhitespace.php</filename>
        <filename>patTemplate/OutputFilter.php</filename>
        <filename>patTemplate/Reader/File.php</filename>
        <filename>patTemplate/Reader/IT.php</filename>
        <filename>patTemplate/Reader/String.php</filename>
        <filename>patTemplate/Reader.php</filename>
        <filename>patTemplate/TemplateCache/File.php</filename>
        <filename>patTemplate/TemplateCache.php</filename>
        <filename mambot="patTemplate">patTemplate.php</filename>
        <filename>patTemplate.xml</filename>
      </files>
    </mosinstall>
    Notice that the file patTemplate.php is given the "mambot" attribute to signify that this is the file to be loaded by the Mambot handler.
  4. Zip up the contents of the /joomla/patTemplate directory and install the Mambot. You should see it listed in the Mambot Manager.
  5. To use this in your code, you would use something similar to the following:
    global $_MAMBOTS;
     
    if (!$_MAMBOTS->loadBotGroup( 'patTemplate' )) {
      die( 'This component requires the patTemplate Plugin' );
    }
     
    $tmpl =& new patTemplate( 'html' );
    There are obviously many other applications for this technique.

Last Updated ( Thursday, 15 September 2005 )
 
< Prev   Next >