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 > Embed

This is a very cool functions which allows you to insert a code snippet into your page.

Suppose you have a nifty bit of javascript you want to insert into you page. BoltWire will not let you add it directly to a page for security reasons. But you can insert it into a protected code page, and then retrieve that code back into your page where desired. Here's how you do it:

Create a page called code.embed.alert (or whatever you want) and insert your javascript there (it can be any kind of code). It might look like this:

<script>
alert("Hello!");
</script>

Code pages are automatically escaped so you can see your input. Make sure you do not give untrusted users write permission to these pages. Now to retrieve the content into your page, just add the following line:

[(embed alert)]

Use this to embed youtube video or a facebook sharing snippet or whatever you want. It will work instantly, unchanged.

If you want to customize your code snippet, perhaps supplying a link, or some text, there are two ways to do this. One is to insert it into the code page as a regular variable. For example, suppose I wanted to customise my hello message:

<script>
alert("Hello !");
</script>

Embedded scripts can take any normal variable. You can also insert a parameter from the embed function as well. Notice this code page, called youtube:

<iframe width="560" height="315" src="{+url}" frameborder="0" allowfullscreen></iframe>

Then I can call this multiple times with a different url each time. Just set the url parameter in the embed function like this:

[(embed youtube url=www.youtube.com/embed/CqSDWoAhvLU)]

If you want to do something more sophisticated, you could store a variety of links as an info page along with a title or keywords. Then the user could search for a video and the template could pull up the appropriate video(s).

Head & Body

Sometimes you need to embed some code in the head of the html page, and sometimes in the body tag. To do that, simply add a second parameter that says head or body and the embedded code will be inserted in the right place. This can be used to create many interesting effects. See the plugins area for examples.