====== BBCode Plugin Tips ====== ===== Enabling Inline HTML ===== Inline HTML allows you to mix BBCode with HTML, without using the (deprecated) [html] tag. Open ''fp-plugins/bbcode/plugin.bbcode.php'' and set ''BBCODE_ESCAPE_HTML'' to ''false'' (versions newer than 0.812 have a control panel option, in the **BBCode Config** plugin section) ===== How to add custom tags ===== If you plan to add new bbcode tags, don't add them right in the core plugin, otherwise on the next update you'll loose all your changes! You can create a **new** plugin with your very own tags by attaching the official one. For more information on how the FP bbcode class works, see the [[http://www.christian-seiler.de/projekte/php/bbcode/doc/en/chapter1.php|official documentation]]. In this example we will show you how to get an acronym tag expecting the acronym as a tag attribute, and the actual meaning as the tag content [acronym=CSS]Cascading Style Sheet[/acronym] ((If you're wondering whether you can have the alternate syntax [acronym=Cascading Style Sheet]CSS[/acronym], then you can't for now. Multiple words are not allowed in tag attributes)) which in your page will look like this: CSS addCode ( 'acronym', // tag name: this will go between square brackets 'callback_replace', // type of action: we'll use a callback function 'plugin_custombbcode_acronym', // name of the callback function array('usecontent_param' => array ('default')), // supported parameters: "default" is [acronym=valore] 'inline', // type of the tag, inline or block, etc array ('listitem', 'block', 'inline', 'link'), // type of elements in which you can use this tag array ()); // type of elements where this tag CAN'T go (in this case, none, so it can go everywhere) $bbcode->setCodeFlag ('acronym', 'closetag', BBCODE_CLOSETAG_MUSTEXIST); // a closing tag is mandatory [/tag] } // $content is the text between the two tags, i.e. [tag]CONTAINED TEXT[/tag] $content='CONTAINED TEXT' // $attributes is an associative array where keys are the tag properties. default is the [tagname=value] property function plugin_custombbcode_acronym($action, $attributes, $content, $params, $node_object) { if ($action == 'validate') { // not used for now return true; } // [acronym=css]Cascading Style Sheet[/acronym] // will become css return "{$attributes['default']}"; } ?>