BBCode presentation

For the presentation you have to convert the BBCode to HTML Code. This is done by calling postbbcode_userapi_bbtohtml. The function simply converts all the defined BBCodes to html code. It should be called everytime pnVarPrepForDisplay or pnVarPrepHTMLDisplay is beeing used for the variable containing the BBCode.

Using this shema the BBCode is only translated for presentation purposes and no HTML code is stored in the database. HTML Code normaly not allowed for presentation can be created using this method.

Example 4-2. change BBCode to HTML

if (pnModAvailable('postbbcode') &&
    pnModAPILoad('postbbcode', 'user'))
{
  // convert bbcode to html
  $html = pnModAPIFunc('postbbcode',
                       'user',
                       'bbtohtml',
                       array("bbcode" => $bbcode));
  if (!isset($html))
  {
     // translation failed -> show non translated
     $html = $bbcode;

  }
}