Welcome

BoltWire is a content management system developed by Dan Vis.

Welcome Tour
Documentation
Mailing List



Popular Posts

Version 5.11 Released
May 26, 2016

Big Changes Coming Soon...
April 28, 2016

Catching Up
April 6, 2016



Other Sites

Here's some other sites by Dan Vis:

Alexa Echoes
Join my adventures developing for Amazons exciting new voice platform.

Firefly Spot
Personal rambling about new gadgets, technology news, and space travel.

FAST Missions
My ministry hub, with news and updates about our online school.

You can follow him at www.danvis.info.

Extending BoltWire

Documentation > Concepts > 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 and put it in config.php, farm.php, or a plugin.

Your config.php file, if you have not yet created one, needs to go in the field/config folder and will be automatically activated on every page in your site.

Your farm.php file, if you have not yet created one, needs to go in the shared/plugins folder and will be automatically activated on every page in all the sites in your installation.

Plugins go in the same directory as farm.php but needs to be manually enabled on site.config for any page or groups of pages where your extensions will be needed.

Either way, all BoltWire scripts should begin with this line, to prevent the script from being unintentionally called:

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

Filling your Toolbox

Once you have created this page, you can begin editing it, adding specific elements. Elements consist of markups, variables, functions, conditionals, and commands, and more. Here's a quick overview:

Markups
To create a custom markup rule, define it using a line like this in your script:

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

To turn off an existing Markup, add:

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

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.

To insert a new rule at some point within an order try this:

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

Variables
To create a custom system variable, add a line like this to your script:

$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 similar to the following to your script:

function BOLTFmyfunction($args) {
       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 BOLTCmycondition($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 mycondition 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 similar to the following to your script:

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

The "BOLTX" prefix means the script will be available to any form submitted to BoltWire using the [command mycommand ..] markup, to do processing as desired. If you desire the output to be available to other form fields afterwards, return the desired value.

Use the various commands available in the commands script as models for how to work with BoltWire forms.

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 utility functions found at the end of the engine script).

TAGS:
To leave a comment, please login using your Facebook account: