Firefox PHP

Better quoting [multi-file hack].

Posted by sabforum.nl 
Better quoting [multi-file hack].
May 23, 2004 01:23PM
I've modified the quoting system so it makes use of the html blockquote element. This way it can be styled with css and you don't get those (imho) ugly >'s everywhere. Plus you'll include any smilies which otherwise'd be lost.
This is especially nice when nesting multiple quotes.
Example:
[www.sabforum.nl]

step 1: Insert the folowing code block in include/db/mysql.php:
-------------------------------------
/**
* This function executes a query to get the raw code from a post for quoting
*/

function phorum_db_get_raw_body($message_id)
{
$PHORUM = $GLOBALS["PHORUM"];

$conn = phorum_db_mysql_connect();

$table = $PHORUM["message_table"];

$sql="select body from $table where message_id=$message_id";

$res = mysql_query($sql, $conn);

list($body) = mysql_fetch_row($res);

return $body;
}
-------------------------------------

Step 2: Modyfing read.php
Search for the folowing part: if(isset($PHORUM["args"]["quote"])){.
In my version (phorum5-cvs-2004052006) it was on line 348.
Replace the following text
-------------------------------------
$phorum_quote_body = strip_body($messages[$message_id]['body']);
$phorum_quote_body=str_replace("\n", "\n> ", $phorum_quote_body);
$phorum_quote_body=wordwrap(trim($phorum_quote_body), 50, "\n> ", true);
$PHORUM["DATA"]["POST"]["body"]="{$messages[$message_id]['author']} {$PHORUM['DATA']['LANG']['Wrote']}:\n".str_repeat("-", 55)."\n> $phorum_quote_body\n\n\n";-------------------------------------
with this:
-------------------------------------
$phorum_quote_body = phorum_db_get_raw_body($message_id);
$PHORUM["DATA"]["POST"]["body"]="[ quote]{$messages[$message_id]['author']} {$PHORUM['DATA']['LANG']['Wrote']}:\n$phorum_quote_body"."[/ quote]\n";
-------------------------------------
Please note that in the example above the quote-tags have a space after the [, to prevent from cluttering the view up here.

Step 3: Make an appropriate css rule.
Since I have an external css-file instead of using the default inline, Im sure this step could be optimised (using template tags for colors etc). Anybody?

Open your css file, and add the following rule:
.PhorumReadBodyText blockquote {
border: 2px solid #39C;
background: #8BE;
margin: 0.5em 2em;
padding: 2px;
}

There you go. You've just added yourself a nice quoting mechanism.

__
Angels will run to defend me.
Re: Better quoting [multi-file hack].
May 23, 2004 10:31PM
You should mention that this hack requires the bbcode module.

Brian - Cowboy Ninja Coder - Personal Blog - Twitter
Re: Better quoting [multi-file hack].
May 24, 2004 07:35AM
This hack requires the bbcode module.

__
Angels will run to defend me.
Sorry, only registered users may post in this forum.

Click here to login