UWAGA: Strona zawiera materiały archiwalne. Większość artykułów dotyczy Joomla! 1.0
Start arrow Programowanie arrow Boty arrow Poszerzanie możliwości
Poszerzanie możliwości Drukuj Email
Redaktor: Stefan Wajda   
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:
        /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">
      <version>3.0 Beta 1</version>
      <Author>Stephan Schmidt</author>
      <license>http://www.gnu.org/copyleft/lgpl.html GNU/LGPL</license>
      <authore-mail>schst @php.net</authore-mail>
      <description>Powerful templating engine</description>
        <filename mambot="patTemplate">patTemplate.php</filename>
    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:
    <a href="http://www.php.net/global">global</a> $_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.
« poprzedni artykuł   następny artykuł »