Welcome Tour
Advanced FeaturesThe power of BoltWire goes far beyond using simple markup to display basic html tags. It also can generate highly dynamic content based on variables, conditionals, and functions. What's more, all three work together to create even more exciting possibilities.
Listed below are just a few examples of how each of these advanced markups work. To learn more about the many variables, conditions, and functions built into BoltWire, please see the appropriate pages in our Handbook.
Variables
Variables are little bits of data you can retrieve and insert wherever you want. For example, suppose you wanted to display the version of BoltWire you are using. Just do this:This is BoltWire version {version}
This is BoltWire version 8.00
Suppose you wanted to display a link to your current page. You could just use this markup. Here, the {p} is a shortcut symbol for the current page:
[[{p}]]
If I want to display the page title instead, I use this syntax:
[[{p}|+]]
Or suppose you want to create a link that takes a user to their individual member page. That can easily be done using the {id} variable. In this case, let's assume they are logged in as "Bob".
[[members.profile&id={id}|Profile Page]]
Suppose you had stored a user's address, city, state, and zip as part of their member profile. You could retrieve them using this syntax:
{~address}
{~city}, {~state} {~zip}
{~city}, {~state} {~zip}
123 Some Street
New City, OK 73045
New City, OK 73045
There are lots of variables in BoltWire of many different types, and you can easily create and retrieve your own variables in a number of different ways. Variables give you nearly limitless options for managing and processing information in your site. Click here for additional information about BoltWire's built-in variables.
Conditionals
Conditionals allow you to only display content when a certain condition is met. For example, this markup will only display a greeting if someone is logged in:[if login]Hello {member}![if]
You can insert an "else" markup if you want to display something different based on the answer to the condition. Notice the following example:
[if editor]
You are authorized to edit this page
[else]
You are NOT authorized to edit this page
[if]
You are authorized to edit this page
[else]
You are NOT authorized to edit this page
[if]
You can also use boolean operators to create more complex conditionals:
[if ! exists some.page && (print || mobile)]
This will only display if the specified page does not exist and either the mobile or print skin is being used.
[if]
This will only display if the specified page does not exist and either the mobile or print skin is being used.
[if]
And yes, you can nest conditionals:
[if login]
You are logged in [if equal {id} bob]as Bob[if]
[if]
You are logged in [if equal {id} bob]as Bob[if]
[if]
Variables and functions can be included in your conditional expressions, and many conditions accept various parameters to control how they work.
BoltWire comes with more than 20 powerful conditionals installed. Click here for more information about BoltWire's conditionals.
Functions
Functions tap into special bits of PHP code to generate various kinds of output dynamically. Here's one example using the breadcrumb function:[(breadcrumb {p})]
Docs > Welcome Tour > Advanced Features
Here's another example tapping into BoltWire's math function:
[(math 2+3)]
5
Here's one that taps into PHP's strftime function. There, the %x parameter indicates the current time should be formatted as a date:
Today is [(time %x)]
Today is 12/10/23
Other functions can be used to include markup (or source code) from another page, generate a search query, silently log information, embed javascript, and much more. You can even forward the user to another page, or send them an email! Most accept multiple parameters to modify how they work.
There are currently well over 20 different functions in BoltWire. Click here for more information about BoltWire's functions and their allowed parameters.
Summary
By combining variables, conditions, and functions with our basic wiki markup, you can display your content in all sorts of dynamic ways. And though it goes beyond the scope of this tutorial, it's super easy to add your own custom variables, conditions and functions by adding simple extensions to the core code.Want even more power? Let's take a look at BoltWire's amazing form processor.
Form Processing