BoltWire

Innovative Ideas :: Radical Results!

INFORMATION

DOCUMENTATION

SOLUTIONS

Info Variables

Documentation > Handbook > Variables > Info Variables

The Basics


BoltWire makes it possible to extract data values from the actual text of a page. Simple create a line that looks like the following:

field: value

Then, to retrieve it, use {::field} or {some.page::field}. The markup will be replaced by "value". That's all there is to it.

Note that the info var pattern can be redefined in a config file to look for other kinds of patterns as well, if desired.

Example

This section defines the info vars:

Title: Some Title
Description: Here is a bit longer description...
Link: some.link

This section retrieves the info vars:

FieldValue
My Title:Some Title
My Description: Here is a bit longer description...
My Link:some.link

Note that info vars can be hidden in a comment markup or using other methods if you do not want them to be visible.

Also remember to make sure there is a space after the colon(:) when defining an info variable. Defining a variable like this (variable:data) would not work.

Editing

This info function and command also allows for editing info vars on another page (assuming allowed on site.auth.info). The syntax for the function looks like:
[(info field= value= target= )]
The syntax for the command looks like:
[session info "field= value= target="]

Note: To edit info vars on pages not normally editable, you can add an authkey parameter to the command and then the corresponding @key line to site.auth.write. This cannot be done with an info function, however.

Possible Uses

The things this script can do are pretty dramatic. You can use info variables to track user input in lists or tags. The ideas below are just the first to come to my mind. Not particularly practical, but they illustrate possibilities:

Granted, most of these things could be done with data vars, but text vars are nice, because you can have the output in the page display.

Here's a simple form for editing info vars on a page.

<code>
[form]
Field [text field] Value [text value]
[submit OK]
[session info "field={=field} value={=value} target=test.info"]
[form]


</code>

Extensions

There are several, powerful Info Extensions to the info command/function found in the solutions area. Use the examples here to develop your own custom extensions. You may also wish to look at the Info Tags solution, for more ideas of the possibilities latent in this function/command.

Advanced

Here are some hurried notes posted to the mailing list going over the info function/command:

For an info function/command, the main fields are field, value, and target. Field is the label (often {p}). Value is what's put there. And target is the page. By default it should be in the info* hierarchy, else you will need to set different site.auth.info settings.

You can also put special command names in the first parameter position ($args[''][0]). Core functions include: delete (a field), count (some base page name), sum (some base page name), list (all fields, csv, for use in list function...), and counter (+1 to field).

Oh, to add a custom extension--like tags or tagcloud, create a function called BOLTinfoTags($info, $args) or BOLTinfoTagCloud. Info is the f:v array of target page. Args anything passed to the function. The infotags script is a good example. There are more in the infox plugin, but haven't tested them since the upgrade. They may work just fine as is. They look ok...


Copyright © 2013, all rights reserved.