The LEPTON Droplets module is based on a module created by Ruud Eisinga, but completely rewritten and with lots of new features.
Droplets are small chunks of php code
(just like the code module) that can be included in your template or any other
content section.
Including a droplet is done by encapsulating the droplet name in double brackets.
Example:
If you want to use the droplet "LoginBox", you only need to add
[[LoginBox]] to your template or a WYSIWYG section on your
page.
You are encouraged to create your own Droplets and share them with the community.
Installation
The Droplets module is installed as an Admin Tool. As it is shipped with
LEPTON >= v2.0, you don't have to install it. If you need to install an
upgrade, just install it like any other module in the LEPTON backend.
Usage
You need to have the permission to access [Admin Tools] -> [Droplets] to
use this tool.
Clicking the tool will display the current installed Droplets. Depending on
your permissions, you will be able to
create (add) your own Droplets;
edit existing Droplets;
activate / deactivate Droplets;
duplicate Droplets (to create a new one based on an existing one);
delete Droplets;
import (install) new Droplets;
export (backup) Droplets;
manage Droplet permissions;
Getting Droplets
A fast growing number of Droplets are available for use, you can use the
Droplets Library on the AMASP project website
or you can search the Forum. You may use any
Website Baker Droplet on LEPTON.
Droplets can be added by copy&paste or by direct upload of an appropriate ZIP file.
Coding Droplets
Droplets run in PHP mode, no <?php
or ?> is allowed in the code!
If any of these tags are found in the code they will be removed. Your code
will not run as expected.
The droplet code can NOT echo or print data to the output stream directly.
The Droplet name is replaced by the return value of the PHP code.
Take a look at the Droplets that come with the module for examples.
Droplets can modify the complete page content.
When the Droplet is called, an extra variable ($oLEPTON_page_data) is made available.
This variable holds all the content of your current generated webpage.
You can modify any part of this content simply by replacing it in the variable.
There is no need to return this variable, the Droplet code will process changed
content automatically.
Droplets will check the PHP code you have saved for validity.
When the code will not execute correctly a red flashing icon
will apear in the backend Droplets list.
The standard blue icon
is no guarantee that the Droplets does what you would expect it to do, it
will just tell you if the code is valid PHP code.
Droplets do not need to return any data. When you end your code with
return true;
there will not be an error message. The processed
Droplet tag will just be removed.
PHP color coding
The Droplets edit page is ready to use the EditArea module. This module
creates a color coded editor for PHP code. EditArea is included with LEPTON,
so you don't need to install it.
Exporting Droplets
You can backup your Droplets checking the checkboxes of the Droplets you
wish to save and hit
This will save all marked Droplets as single PHP files into a ZIP file. You
can take this ZIP and it on another
LEPTON Installation, for example.
To see a list of all backups you created, click on the
button. This button will only
appear if there really are backup files. You can now manage your backups,
i.e., delete, recover or download them, see how much files (=Droplets) are included,
and even view a list of included files. To see the list, place the mouse pointer on the file
name; a "tooltip" will appear that shows the files contained in the ZIP.