BoltWire

Innovative Ideas :: Radical Results!

INFORMATION

DOCUMENTATION

SOLUTIONS

Extending BoltWire

Documentation > Extending BoltWire

Want to build your own BoltWire extensions? BoltWire is specially configured to instantly identify and make available custom extensions as long as a few simple rules are followed. Here's an overview:

How to Extend BoltWire

First, you will need to write a custom PHP function in one of the config.php files, depending on where you want your extension to be avalaible (page wide, field wide or farm wide). Or if you prefer, you can put them in a plugin page (in your farm plugin folder), and enable it in site.config like any other plugin. Either way, your php script should begin with this line:

<?php if (!defined('BOLTWIRE')) exit();

Once you have created this page, you can begin editing it, adding specific elements. Elements consist of markups, variables, functions, conditionals, and commands. Click any of the links below for more examples.

Note you may also adjust many configuration settings in a config or plugin page.

Markups

To create a custom markup rule, define it using a line like this in your local toolbox page:

MarkUp('order', 'rule', '/pattern/', 'output');

To turn off an existing Markup, add:

MarkUp('order', 'rule', '');

Normally new rules are appended to the appropriate order. To insert a new rule at some point within an order try this:

MarkUp('order', 'newrule < oldrule', '/pattern/', 'output');

Study the existing markup for examples of possible patterns and outputs. To control when the processing takes place, set the order to an existing order, and the rule will be appended to the end of that order.

Variables

To create a custom system variable, add a line like this to your local toolbox page:

$BOLTvar['$varname'] = "Some Value";

This will cause {varname} to be replaced by "Some Value". You can of course use PHP functions to define your new system variable. See the bottom half of the variables script for examples.

Functions

To add a new function to BoltWire, create a PHP function in your local toolbox page similar to the following:

function BOLTFmyfunc($args, $zone) {
       your php commands...
      return $output;
      }

The "BOLTF" beginning tells BoltWire to make this function available to your site via the markup:[(myfunction parameters)]. Note that the parameters string will be passed to the function as a parsed array of $args.

.

Conditions

To create a new condition, add a new PHP function in the following format:

function BOLTCmycond($args) {
       your php commands...
      return true; or false
      }

The "BOLTC" beginning, tells BoltWire to make this function immediately available to your site, using the markup [if mycond parameters]. Note that the entire parameters string will be passed to the function as a parsed array of $args.

The output of the function should always return true or false depending on the parameters passed to it. See the conditions script for a number of examples available by default in BoltWire.

Commands

To create a new form command, simply add a new PHP function to your local toolbox page, that takes a form field (name) and value, similar to this:

function BOLTCmycond($value, $field) {
       your php commands...
      return $newvalue;
      }

The "BOLTX" prefix means the script will be available to any form submitted to BoltWire, to do processing as desired. If you desire the output to be available to other form fields afterward, return the new value for the field.

Use the various commands available in the commands script as models for how to work with BoltWire forms. Especially note how the BOLTarray variable is used. If you create a function that writes to pages, you may want to append it to the $BOLTsessionCommands variable. You can however create your own security system using the BOLTauth command.

Note: In writing extensions for BoltWire, you will also find it useful to familiarize yourself with the core BoltWire php functions. These are mostly found in the library script, listed alphabetically (with a few additional functions found after the initial 100 lines or so of the engine script).

Copyright © 2013, all rights reserved.