Join Now

Click here to join our
growing community:

JOIN LOGIN



Docs

Welcome Tour
Handbook
      Markups
      Variables
      Conditions
      Functions
      Forms
      Commands
      Concepts
Extensions
Pro Modules
Developers



Copyright © 2020
Terms of Use
Privacy Policy
BoltWire

Handbook

Insource

The insource conditional checks whether some text exists on a specified location.

The first parameter (or parameter 'page') is passed to the source function to retrieve a value to scan. It can be a page, a section of a page, a date or info variable, or anything else that function can return. See the source function for more details.

The second parameter (or parameter 'find') tells what we are looking for on the page. It is required.

Here are some examples of how it is used. Each checks to see whether the letters "pi" is found on some.page, in the anchored section on the specified page, in the data var on the page, or in the info var on the page, respectively.

[if insource some.page 'pi']true[else]false[if]
[if insource some.page#anchor 'pi']true[else]false[if]
[if insource some.page:datavar 'pi']true[else]false[if]
[if insource some.page::infovar 'pi']true[else]false[if]

The check does not take into account word boundaries, so it will return true if the word "happiness" exists on the source and you are checking for "pi".

Note: the following conditional will fail because BoltWire expects the find parameter to be in position two, but BoltWire sees it as being in parameter one. It will return false automatically

[if insource page=some.page 'pi']true[else]false[if]

A case=false parameter can be added to make the check case insensitive. In the first example, the case must match perfectly to pass. In the second: pi, PI, Pi, or pI will match.

[if insource some.page 'pi']true[else]false[if]
[if insource some.page 'pi' case=false]true[else]false[if]

Note: spaces in your find parameter will produce unexpected results unless they are enclosed in quote marks. The first example will return true if 'pink' is found on the page. The second example will cause BoltWire to look for the word 'elephants' as that is what appears to be in the second parameter position. Only the third example will search for the intended phrase.

[if insource some.page pink elephants]true[else]false[if]
[if insource page=some.page pink elephants]true[else]false[if]
[if insource some.page 'pink elephants']true[else]false[if]

Page shortcuts are accepted with this conditional.

View authorizations are checked with this function. So if a user is not authorized to view a page, the conditional will fail.

You can check a stamp page by setting dir=stamps.

You can set lines=1-10 to see if your string appears in the first ten lines.

You can check for a post, get or cookie value just as in a normal source function.

You can check for multiline matches by using \n to represent the text you want. For example, the following will match if pink and elephants are found on some.page with a line break between.

[if insource some.page "pink\nelephants"]true[else]false[if]