Introduction

[Taken from phpbb.com ]

Since I'm old (as my daughter keeps telling me...) I remember that back in the days of Bulletin Boards people were looking for a way to add links and images into what was a restricted system. The answer was a hacked together language called BB Code. To a large degree it worked well, and I do have fond memories of it, and when I came to do my Idle Blog website I decided it was a perfect place to implement it. If only for nostalgia more than anything else.

BBCode is a special implementation of HTML. Whether you can actually use BBCode in your posts on the forum is determined by the administrator. In addition you can disable BBCode on a per post basis via the posting form. BBCode itself is similar in style to HTML, tags are enclosed in square brackets [ and ] rather than < and > and it offers greater control over what and how something is displayed. Depending on the template you are using you may find adding BBCode to your posts is made much easier through a clickable interface above the message area on the posting form. Even with this you may find the following guide useful.

Examples

BBCode includes tags to allow you to quickly change the basic style of your text. This is achieved in the following ways:

  • To make a piece of text bold enclose it in [b][/b], e.g.
    [b]Hello[/b]
    will become Hello

  • To italicise text use [i][/i], e.g.
    This is [i]Great![/i]
    would give This is Great!

There are more features and functions such ass adding images, adding links and even the "Spoiler" function. 

No need to worry I have examples in the link provided above! And as always if you need help just reach out to me

Problems

The main problem with this was:

  1. Finding the filters in the block of text
  2. Leaving the existing content alone
  3. Applying the changes and returning desired content changes

Solution

The solution was to use pattern recognition functions and work through the list of options, this helped perform the desired tasks in a non destructive manner. 

PHP was not the only answer, I did employ some simple CSS and Javascript to perform the task of "Spoilers" But this was an optional extra and can be left out if needed. 

Tech Stack:

Need Help With Your Project?

Need help with your project? Book a free session with me to discuss your specific project requirements and how I can help you.
Color Switcher