Forums Quotes

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Forums Quotes

Post by s.dot »

I was wondering if this would be the most effecient way to add quote functionality to my forums? (I don't think it is because it seems impractical, although it works)

Code: Select all

// form data has been submited $entry = returned forum entry

$entry2 = mysql_real_escape_string(nl2br(strip_tags($entry)));
$entry3 = str_replace("&#1111;QUOTE]", "<p style='border: solid 1px #000000'>", $entry2);
$entry4 = str_replace("&#1111;/QUOTE]", "</p>", $entry3);

// submit entry 4 to database
This works fine, but I'm sure it's not how it's done in professional forums. Also, using this method, there's no way to get the username of the person who is being quoted ($author).
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

take a look at the bbcode class/functions on evilwalrus.com or bbcode.php in phpbb's code..
Post Reply