Development Wiki

Tutorial.Parsing text

From phpBB Development Wiki

Revision as of 12:32, 6 January 2007 by Lew21 (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Parsing text with BBCodes, smilies etc.

Inserting text to the DB

$text "bla bla bla"// will be modified by generate_text_for_storage
$uid $bitfield $flags ''// will be modified by generate_text_for_storage

$allow_bbcode $allow_urls $allow_smilies true// false is default for generate_text_for_storage function

generate_text_for_storage ($text$uid$bitfield$flags$allow_bbcode$allow_urls$allow_smilies);

$sql 'INSERT INTO ' YOUR_TABLE " (text, bbcode_uid, bbcode_bitfield) VALUES ('$text', '$uid', '$bitfield')";

Displaying text downloaded from DB

$sql 'SELECT text, bbcode_uid, bbcode_bitfield FROM ' YOUR_TABLE;

$allow_bbcode $allow_urls $allow_smilies true;

$flags = (($allow_bbcode) ? 0) + (($allow_smilies) ? 0) + (($allow_urls) ? 0);
$text generate_text_for_display($row['text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $flags);


Generating text for editing

$sql 'SELECT text, bbcode_uid FROM ' YOUR_TABLE;

decode_message($row['text'], $row['bbcode_uid']);

This article is a stub. You can help in improving Olympus Documentation by expanding it.