Stephan: bb-Code

Beitrag lesen

Wie mache ich das, jetzt habe ich es geschnallt, das steht jetzt in meiner Datei:

require 'bbcode.inc.php';

function do_bbcode_url ($tag_name, $attrs, $elem_contents, $func_param, $openclose) {
    // Tag hatte nicht das default-Attribut
    if ($openclose == 'all') {
        return '<a href="'.htmlspecialchars($elem_contents).'">'.
            htmlspecialchars($elem_contents).'</a>';
        // Tag hatte das default-Attribut und das hier ist der öffnende Tag
    } else if ($openclose == 'open') {
        return '<a href="'.htmlspecialchars($attrs['default']).'">';
    // Tag hatte das default-Attribut und das hier ist der schließende Tag
    } else if ($openclose == 'close') {
        return '</a>';
    // Irgendwas seltsames geht vor sich
    } else {
        // Fehler
        return false;
    }
}

$bbcode = new BBCode ();

$bbcode->addParser ('htmlspecialchars', array ('block', 'inline', 'link'));
$bbcode->addParser ('nl2br', array ('block', 'inline', 'link'));

$bbcode->addCode ('b', 'simple_replace', null, array ('<b>', '</b>'),
                  'inline', array ('block', 'inline', 'link'), array ());
$bbcode->addCode ('i', 'simple_replace', null, array ('<i>', '</i>'),
                  'inline', array ('block', 'inline', 'link'), array ());
$bbcode->addCode ('url', 'usecontent?', 'do_bbcode_url', array ('default'),
                  'link', array ('block', 'inline'), array ('link'));

Aber wi mache ich jetzt ein Bild, das habe ich nämlich in der Beschreibung nicht gefunden...

Falls es in der Beschreibung doch ist, reicht die Überschrift, genauso mit den textfarben...

Danke schon jetzt

Stephan