Cancel

Oops, I want to edit this page in a built-in Constructor or as an HTML Source only.

[insert=topmenu.tpl]

How to use a bbCode?

It is a short instruction that demonstrates how to create a bbCode and use it.

Creating

First you need to add or upload the bbCode file you want. Let's make an example and name it "My Random Number".

I will describe this process step by step. First of all, you need to Log In to the site as an administrator. It looks like this:

Then you should go to the bbCodes page. It looks like this:

There are two possible ways.

Way 1

If you want to enter bbCode markup from blank sheet, you should use the Add New button. It looks like this:

Suppose you want to use the following markup for that bbCode. It simply displays a message "My random number is ..." with a generated random number:

<p>
    My random number is
    <?php echo rand() ?>
</p>

So, when adding a new bbCode, you need to enter the following data in the input form as shown in the screenshot below.

Way 2

If you already have a marked up bbCode file, you should use the Upload New button. It looks like this:

Please note that in each of these ways, you will have to specify a relative URL of the bbCode file that will be saved. Let's specify it as my/random-number.tpl as shown in the screenshots above.

Great

You have just uploaded or added a new bbCode. Its URL should immediately appear in the bbCodes list, as shown in the next screenshot.

Now you are ready to use this bbCode on any static pages of your site.

Using

Now you should go to the page Add New Page and try to use the "Insert dynamic block" tool.

This drop down button will contain all your bbCodes including the my/random-number.tpl you just created. You need to click on this element to insert its [insert=my/random-number.tpl] tag into the page.

It looks like this:

Now, when a visitor sees this page, it will look like this.

Static input parameters

You may pass some unnamed parameters to your bbCode. These parameters must be declared after the bbCode file name separated by spaces. For example, let's define two parameters: 123, 456 - to generate a random number in the range 123 ... 456.

<p> [insert=my/random-number.tpl 123 456] </p>

However, you should remember that the input parameters are optional. The administrator can declare them at his own discretion. For example:

<p> [insert=my/random-number.tpl        ] </p>
<p> [insert=my/random-number.tpl 123 456] </p>

So you will have to take this situation into account. Let's change the bbCode file above to use these optional parameters:

<p>
    My random number is
    <?php echo isset($params[1]) ? rand($params[0], $params[1])
                                 : rand() ?>
</p>

Good luck!