Dwoo can be extended in many ways; you can add extra blocks, functions and filters*. You can even extend the Core itself for your application.
A global variable is like any other template variable, except that it’s available in all templates.
Actually globals are defined in the
Coreclass and cannot be modified directly.
1.3.2, this feature is now available, let's see how to use it:
You can now use your new global variable such as:
Creating custom Plugin(s)
In addition to providing you with an abundance of built-in plugins, Dwoo also allows you to create your own.
These plugins may be implemented as user-defined functions or standalone classes, and can be either manually added at
run-time via Dwoo’s
addPlugin() method or automatically loaded by the Dwoo autoloader.
To illustrate, consider the following script, which sets up a simple plugin to manipulate email addresses:
fix_address() function replaces common email address characters with human-readable words, in order to
make it harder for spammers to harvest these addresses from Web pages.
addPlugin() method takes care of adding this function to Dwoo’s plugin list, specifying both the local plugin
name and the function callback.
Here’s how you’d use it in a template:
If you want add more than one custom plugin, you can specify to the loader a custom directory to search for, such as:
Allow/Disallow PHP native functions
Dwoo allow users to use PHP native functions within the template.
Default allowed PHP functions are:
However, developers can decide to allow more but also disallow less PHP functions to be used within template.
To do so, you just need to follow this example: