SupportArea

BoltWire is a FREE content management system written in PHP.

Its innovative architecture combined with best-in-class forms processing makes it ideal for creating complex, interactive, web applications fast...


Documentation

Markups
Variables
Conditions
Functions
Forms
Commands
Cheatsheet

Documentation

Handbook > Functions > Forward

This function redirects the browser to the page specified in the first parameter. To forward to another page within your site, just do:

[(forward some.page)]

To forward to an external site, be sure to use the full url, like this (it looks for "://")

[(forward http://google.com)]

If you wish to forward on certain conditions, make sure you use the conditional function format. In the examples below, the first two will always forward because they are processed before the conditionals. In the third, it will behave as expected, because that format is processed after the conditional:

[if ! admin]{(forward error.page)}[if]
[if ! admin][(forward error.page)][if]
[if ! admin]<(forward error.page)>[if]

You can include variables as part of the link as well. So you could for example create a page called office and include on it this content:

[if login]<(forward action.login)>[else]<(forward office.{id}[if]

You can also include get variables as in the example below, and {?field} will be available to you in the page you are forwarded to:

<(forward some.page&field=value)>

If you create a forwarding loop, the function will fail and give an error message.

You can daisy chain this function (up to 4 times) to bounce from one page to another--and even use conditionals to create some kind of logic tree. Or you can have BoltWire forward to a page, do some action, and then return to the original page, using a conditional to stop further processing. To do this, check the value of the 'forwards' GET variable. For example:

On some.page put this markup:

[if ! set {?forwards}]<(forward.action.log)>][if]
<(include log.visitors)>

Then on action.log put this markup:

[(log "{id} was here!" page=log.visitors)]
<(forward some.page)>

The user goes to some.page. BoltWire sees there have been no forwards and the user is sent over to action.log. That page is loaded, and the log message is recorded. Then the forward function sends them back to some.page. It notices that 'forwards' has been set (to 2) so this time the forwarding fails. Lastly the log contents is displayed.

From the users perspective, he simply goes to some.page and sees any existing log message. Each time he refreshes the page another line is added.