Progressbar / Statusbar BBcode 2.0

Eingetragen von Lord|Schirmer am Di, 06. Jan 2015 - 20:23


So hier mal die Umsetzung für das Einfügen einer Statusbar / Progressbar im BBCode 2.0 auf reiner CSS Basis.

Format: [status=XX]YY[/status] (XX = Zahl von 0-100 ohne Prozentzeichen / YY = Bescheibung)

Beispiel: [status=75]Ich habe zwei Drittel schon erreicht[/status]

Bilder: +


Folgenden Code (Zeile 728-730) in include/includes/class/bbcode.php einfügen:

include/includes/class/bbcode.php
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
//> Darf BB Code [S] dekodiert werden?
if($this->permitted['s'] == true) {
    //> Format: [s]xxx[/s]
    $this->pattern[] = "%\[s\](.+)\[\/s\]%Uis";
    $this->replace[] = "<strike>\$1</strike>";
}
 
//> Format: [status=XX]YYY[/status] (XX = Zahl von 0-100 / YYY Bescheibung)
$this->pattern[] = "%\[status=([0-9]|[1-9][0-9]|100)\](.+)\[\/status\]%Uis";
$this->replace[] = "<div class=\"status\"><div class=\"status-desc\">$2</div><div class=\"status-stat\">$1%</div><div class=\"status-bar\" style=\"width:$1%\"></div></div>";
 
###############################################
 
 
//> Darf BB Code [LEFT] dekodiert werden?
if($this->permitted['left'] == true) {
    //> Format: [left]xxx[/left]
    $this->pattern[] = "%\[left\](.+)\[\/left\]%Uis";
    $this->replace[] = "<div align=\"left\">\$1</div>";
}


Nun noch in deine style.css (im Ordner include/designs/) die CSS-Formatierung des Balkens einfügen. Diese kann dann in Form und Farbe angepasst werden.



FERTIG!