You are not logged in.

  • Login

1

Monday, February 13th 2006, 5:09pm

BBCODE

Hallo

Ich hab zwar des von unten schon gelesen aber des bringt mich net weiter!
Ich suche eine Datei(einmal includen) dann ne funktion über den Text laufen lasse und fertig!! Gib es so ne Datei?

2

Monday, February 13th 2006, 5:16pm

klar, der selbe code wie im erwähnten thread.
nur hatte der poster noch andere probleme

also ganz einfach
BB Klasse runterladen

PHP Quellcode

1
2
3
4
require_once('bbcode/stringparser_bbcode.class.php');
$bbcode = new StringParser_BBCode (); 
$alter_text = "[b]fetter bbcode[/b]";
$neuer_text = $bbcode->parse($alter_text);

3

Monday, February 13th 2006, 5:30pm

PHP Quellcode

1
2
3
4
require_once('config/stringparser_bbcode.class.php');
$bbcode = new StringParser_BBCode ();
$neuer_text = $bbcode->parse($row['Inhalt']));
echo  $neuer_text;

4

Monday, February 13th 2006, 5:34pm

Funktioniert net!
Gibt zwar den String aus aber wandelt ihn net um!

5

Tuesday, February 14th 2006, 10:35am

ok, hast recht..

hab dir noch 2 extra dateien aus der Doku erstellt, danach sollte es funkionieren
kopiere erstmal die beiden klassen dateien in den ordner bbcode
dann kopiere die datei easy-coding-parser.php in den ordner bbcode

daraufhin kannst du den inhalt der datei test.php überall verändern (gegebenfalls den pfad ändern)

test.php

PHP Quellcode

1
2
3
4
5
6
7
<?
define('DIR','bbcode');
require_once (DIR.'/easy-coding-parser.php');
 
 
echo $bbcode->parse ('[b]Dies ist ein Test![/b]');
?>


bbcode/easy-coding-parser.php

PHP Quellcode

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?
// Zeilenumbrüche verschiedener Betriebsysteme vereinheitlichen
function convertlinebreaks ($text) {
    return preg_replace ("/\015\01	2|\015|\012/", "\n", $text);
}
 
// Alles bis auf Neuezeile-Zeichen entfernen
function bbcode_stripcontents ($text) {
    return preg_replace ("/[^\n]/", '', $text);
}
 
function do_bbcode_url ($action, $attributes, $content, $params, $node_object) {
    if ($action == 'validate') {
        return true;
    }
    if (!isset ($attributes['default'])) {
        return '<a href="'.htmlspecialchars ($content).'">'.htmlspecialchars ($content).'</a>';
    }
    return '<a href="'.htmlspecialchars ($attributes['default']).'">'.$content.'</a>';
}
 
// Funktion zum Einbinden von Bildern
function do_bbcode_img ($action, $attributes, $content, $params, $node_object) {
    if ($action == 'validate') {
        return true;
    }
    return '<img src="'.htmlspecialchars($content).'" alt="">';
}
 
require_once(DIR.'/stringparser_bbcode.class.php');
$bbcode = new StringParser_BBCode ();
$bbcode->addFilter (STRINGPARSER_FILTER_PRE, 'convertlinebreaks');
 
$bbcode->addParser (array ('block', 'inline', 'link', 'listitem'), 'htmlspecialchars');
$bbcode->addParser (array ('block', 'inline', 'link', 'listitem'), 'nl2br');
$bbcode->addParser ('list', 'bbcode_stripcontents');
 
$bbcode->addCode ('b', 'simple_replace', null, array ('start_tag' => '<b>', 'end_tag' => '</b>'),
                  'inline', array ('listitem', 'block', 'inline', 'link'), array ());
$bbcode->addCode ('i', 'simple_replace', null, array ('start_tag' => '<i>', 'end_tag' => '</i>'),
                  'inline', array ('listitem', 'block', 'inline', 'link'), array ());
$bbcode->addCode ('url', 'usecontent?', 'do_bbcode_url', array ('usecontent_param' => 'default'),
                  'link', array ('listitem', 'block', 'inline'), array ('link'));
$bbcode->addCode ('link', 'callback_replace_single', 'do_bbcode_url', array (),
                  'link', array ('listitem', 'block', 'inline'), array ('link'));
$bbcode->addCode ('img', 'usecontent', 'do_bbcode_img', array (),
                  'image', array ('listitem', 'block', 'inline', 'link'), array ());
$bbcode->addCode ('bild', 'usecontent', 'do_bbcode_img', array (),
                  'image', array ('listitem', 'block', 'inline', 'link'), array ());
$bbcode->setOccurrenceType ('img', 'image');
$bbcode->setOccurrenceType ('bild', 'image');
$bbcode->setMaxOccurrences ('image', 2);
$bbcode->addCode ('list', 'simple_replace', null, array ('start_tag' => '<ul>', 'end_tag' => '</ul>'),
                  'list', array ('block', 'listitem'), array ());
$bbcode->addCode ('*', 'simple_replace', null, array ('start_tag' => '<li>', 'end_tag' => '</li>'),
                  'listitem', array ('list'), array ());
$bbcode->setCodeFlag ('*', 'closetag', BBCODE_CLOSETAG_OPTIONAL);
$bbcode->setCodeFlag ('*', 'paragraphs', true);
$bbcode->setCodeFlag ('list', 'paragraph_type', BBCODE_PARAGRAPH_BLOCK_ELEMENT);
$bbcode->setCodeFlag ('list', 'opentag.before.newline', BBCODE_NEWLINE_DROP);
$bbcode->setCodeFlag ('list', 'closetag.before.newline', BBCODE_NEWLINE_DROP);
$bbcode->setRootParagraphHandling (true);
?>
Torben Brodt has attached the following file:

6

Tuesday, February 14th 2006, 4:11pm

Hallo danke !!
Aber des hab ich au geschaftt hat gestern nacht funktioniert!!
Wer lesen kann hat nen vorteil (Doc) ;)

gibt es einen Editor für webseite für bbcode (JAVA) wie z.b der hier wo diese Funktionen ausgewählt werden können?

7

Tuesday, February 14th 2006, 4:26pm

was verstehst du unter einem editor für websiten?
Suchst du ein content management system, dass bbcode kann?

oder willst du einen fertigen code aus textarea und buttons haben?
ich nehme an du willst 2teres.. dazu gibt es auch eine lösung von der bbCode homepage bzw. selfhtml

http://aktuell.de.selfhtml.org/tippstricks/javascript/bbcode/
einfach den javascript part in eine externe auslagern:
z.B. bbform.js (wie angehängt)

danach per

wcf.bbcode.html4strict.title

1
<script type="text/javascript" src="bbcode.js"></script>
einbinden

und die buttons nacheinander einbauen..

wcf.bbcode.html4strict.title

1
2
3
4
5
6
7
8
9
<form name="formular" action="">
    <p /><textarea name="eingabe" cols="30" rows="10">Ihre Nachricht</textarea></p>
    <p />
<input type="button" value="Link Einfügen" onClick="insert('[url]', '[/url]')"> 
<input type="button" value="Bild Einfügen" onClick="insert('[img]', '[/img]')">
<input type="button" value="F" onClick="insert('[b]', '[/b]')">
<input type="button" value="K" onClick="insert('[i]', '[/i]')">
<input type="button" value="U" onClick="insert('[u]', '[/u]')">
  </form>
Torben Brodt has attached the following file:
  • bbform.js (1.83 kB - 180 times downloaded - latest: Apr 18th 2012, 3:20am)

8

Tuesday, February 14th 2006, 4:34pm

ja danke !!!

9

Wednesday, February 15th 2006, 12:52pm

Hey,

ich war ja damals der der auch danach gefragt hatte.

Im end effekt ist doch der Java bCode um einiges Leichter zu verstehen oder?
Also anhand deinen Beispielen Donut.
Und das ganze ist nicht so sehr aufwendig finde ich ;).

//EDIT: Hey, ich habe das ma eingebut alles wie es sein soll aber die Buttons fügen das nicht ein!!!: schau

http://www.tut-base.net/?activ=contact


greetZ Shorty

10

Wednesday, February 15th 2006, 2:09pm

du hast die wichtigsten sachen vergessen.. formular name und name des textfeldes musst du noch ergänzen/ändern

Quoted

<form name="formular" action="">
<p /><textarea name="eingabe" cols="30" rows="10">Ihre Nachricht</textarea></p>
[...]
</form>

11

Wednesday, February 15th 2006, 4:09pm

kalr weiß ich schon!!

12

Wednesday, February 15th 2006, 6:43pm

ah danke =)

13

Monday, October 12th 2009, 2:14am

HuHu,

Habe mich auch mal daran versucht.
Leider bekomme ich PHP Warnungen da ich PHP 5.3.0 nutze.
Gibt es bereits eine neue Version die damit lauffähig ist?

lg
klarica

14

Monday, October 12th 2009, 6:22pm

die aktuellste Version ist 0.3.3 vom 2008-03-27,
Das Projekt scheint wohl nicht mehr weiterentwickelt zu werden.

15

Monday, October 12th 2009, 9:01pm

HuHu,

Jep, Ich habe aber von meinem Ex Mann eine bbcode klasse bekomme und bin ganz zufireden damit.
Hat sich also erledigt.

Similar threads

Social bookmarks