BoltWire

Innovative Ideas :: Radical Results!

INFORMATION

DOCUMENTATION

SOLUTIONS

Config Files

Documentation > Administration > Config Files

BoltWire has a very versatile system of advanced configuration involving files. These configuration files are php files, and they must be stored in the field config folder. Their first line should be:

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

Locations

Sitewide config files


Create a config.php file in your config folder, and it's settings will be applied to the entire site.

Local config files


To create a configuration file for a page or group of pages, just name the file after the page or group you want to make it available in, prefixing it with config and appending it with a php ending. Then, drop it in your config folder. For ex: config.forum.php will be applied to any pages in the forum hierarchy.

When loading a BoltWire page, the engine always loads the file config.php (the sitewide configuration). Then it does a quick hierarchical search for any other config files in the config folder matching the current page name. The first one it finds (the one closest to the current page name) is automatically loaded. No further config files are loaded.

Farm wide config.php


If you need some common configuration for several sites in a multisite BoltWire installation, you can create a config.php file for it (the suggested folder is farm/config) and include it from the site config.php files, adding this line at the top:

<code>
include_once("$boltwire/farm/config/config.php");
</code>

The $boltwire variable points to the BoltWire installation folder and is set in the site index.php file, e.g.:

<code>
$boltwire='../boltwire/2.29';
include_once("$boltwire/barn/scripts/engine.php");
</code>

Modifying Config Settings


Though it's generally easiest to modify configuration setting by adding or modifying an entry in the page site.config, sometimes you might want more control --such as having different settings in different sections of your site, or only on certain conditions. This can be done easily in a config.php file.

To change for example the "crypt" config value, add a line like the following to a config file:

<code>
$BOLTconfig['boltcrypt'] = 'somevalue';
</code>

You can change these settings dynamically using any PHP command you wish --including commands that tap into BoltWire's internal processing and variables. For example, you could do something like this:

<code>
if (BOLTMmemberVar('skin') != '') $BOLTskin = BOLTMmemberVar('skin');
</code>

This checks to see if a skin data value has been set in the user's profile page. If so, the active skin is reset to their profile's preference. Virtually anything is possible using these config files.

You can also turn plugins on or off in a config file--in a dynamic way if desired. Such as enabling them for certain group memberships or by other criteria. To do this, try code like the following:

<code>
$BOLTplugins['myplugin'] = '';
$BOLTplugins['myplugin'] = 'test*,some.page,another.page';
unset($BOLTplugins['myplugin']); turns it off
</code>

Other System Settings


There are many other system settings that can be modified in a config file. This section needs to be developed, but here are some:

Attribute Settings. Attribute settings can be modified in a configuration file by defining $BOLTattrs['field'] to define the allowed parameters: text, checkbox, radio, password, hidden, image, select, option, box, file, button, submit, reset, link, t, r, c, h, span, p, div, img, php, html, session. Each of these have security implications, so be careful before resetting the default values.

Javascript. You can define certain javascript functions you would like to make available to BoltWire forms. Here's two the are included in the core. You could add more, or redefine these, using the examples given:

<code>
$BOLTformJs['clear'] = "onFocus=this.value=''";
$BOLTformJs['submit'] = "onClick='this.form.submit()'";
</code>


Group Memberships. You can reset group memberships dynamically. Solutions like Virtual Wiki's, Public, and Fancy Auths give some good examples of effects you can achieve this way.

Adding New Elements

Another thing you are likely to want to put in a config file are new elements (extensions to the core building blocks). BoltWire is built on five kinds of elements you can mix and match in many combinations: markups, variables, functions, conditions, and commands.



BoltWire is designed to automatically identify any such elements you put in a configuration file (based on a simple naming convention) and make them automatically accessible to your wiki. Mix or match several tools in one script, or just add that one feature you need. It's all up to you.

There are many examples of each of these in the code barn, and more can be found in the various solutions. Study the appropriate script carefully and use one system to your needs as a basis for your custom function. Give it a unique name, modify it as desired, and add it to your config file (page wide, group wide, site wide or farm wide). It's automatically available in your site.

There's a tutorial on how to write custom elements here. You can also put these extensions in a custom plugin, if you enable it in site.config.

Replacing Default Scripts


If you wish to override any of the existing scripts in BoltWire's code barn, such as using a completely different markup table, or a more limited set of commands, simply create a corresponding file (with the same name as the barn script) and drop it into your config folder. You can also create a page like test.markups.php, if you want a custom markup table just for the test group. BoltWire will search your config folder hierarchically for each script first and load it instead of the barn script if one is found.

Replacing scripts is not generally recommended however, as it will prevent your site from taking advantage of any upgrades to the core BoltWire code. Also, there are some dependencies between scripts, so you will need to make changes with care. Still, this makes it possible to modify BoltWire's code with virtually unlimited flexibility.

Copyright © 2013, all rights reserved.