PDA

View Full Version : Old school (WebBBS-style) quoting


Martin CX
10-17-2004, 10:00 PM
This is as much for my own benefit as others. The hack is working fine, but there is a known bug in that the quoting only applies to forum posts and not private messages.

In newreply.php just below the line...
$pagetext = trim(strip_quotes($pagetext));
...insert the following
// HACK BEGIN
function word_wrap ($string)
{
$cols = 80;
$prefix = "?";
$t_lines = split("\n", $string);
$outlines = "";
while(list(, $thisline) = each($t_lines))
{
$thisline = trim($thisline);
if(strlen($thisline) > $cols)
{
$newline = "";
$t_l_lines = split(" ", $thisline);
while(list(, $thisword) = each($t_l_lines))
{
while((strlen($thisword) + strlen($prefix)) > $cols-15)
{
$cur_pos = 0;
$outlines .= $prefix;
for($num=0; $num < $cols-16; $num++)
{
$outlines .= $thisword[$num];
$cur_pos++;
}
$outlines .= "\n";
$thisword = substr($thisword, $cur_pos, (strlen($thisword)-$cur_pos));
}
if((strlen($newline) + strlen($thisword)) > $cols-15)
{
$outlines .= $prefix.$newline."\n";
$newline = $thisword." ";
}
else
{
$newline .= $thisword." ";
}
}
$outlines .= $prefix.$newline."\n";
}
else
{
$outlines .= $prefix.$thisline."\n";
}
}
return $outlines;
}
$pagetext = word_wrap($pagetext);
// HACK ENDScreenshot attached.

Best wishes,

Edit: I forgot. In order to not make it look crazy, you have to leave the "newpost_quote"-template empty except for "$pagetext"

Polo
10-18-2004, 10:26 PM
Thanks Martin CX for sharing your mod... i'm sure many will find it useful...

James T Brock
10-18-2004, 11:14 PM
So this does nothing but change the way quotes look, so it looks like the old style quotes sytem on older software boards?

Do you still need to use quote tags and it just converts it, or would you need to use >>'s?

Martin CX
10-18-2004, 11:28 PM
So this does nothing but change the way quotes look, so it looks like the old style quotes sytem on older software boards?

Do you still need to use quote tags and it just converts it, or would you need to use >>'s?You don't need to use quote tags, it automatically >>'s the text from the post you are replying to.

In this case, had I replied to your message, this is what it would have given me:

?So this does nothing but change the way quotes look, so it looks
?like the old style quotes sytem on older software boards?
?
?Do you still need to use quote tags and it just converts it, or
?would you need to use >>'s?

BTW, I use the prefix '?' as I think it looks nice, but if you want to use '>' or '> ' you can just change it. (It is the prefix variable in the beginning of the script.) And if you want to change the number of characters before the line wraps it is the cols variable.

And thank you, Polo. I hope so.

Erwin
10-19-2004, 12:18 AM
Great idea. Definitely old school. :)

Boofo
10-19-2004, 01:46 AM
Is there a way to add the name of the person you are quoting also? ;)

Martin CX
10-19-2004, 03:12 AM
Is there a way to add the name of the person you are quoting also? ;)Sure, but I think it is perhaps easiest achieved by just editing the "newpost_quote"-template and leave something like...?(b)$originalposter wrote:(/b)
?
$pagetext...or whatever you have in mind (brackets instead of parenthesis, of course).

Best wishes,

HiDeo
10-19-2004, 03:39 AM
Nice hack !

Thanks Martin CX

/me installs

alkatraz
10-19-2004, 07:49 AM
lovin the bbs style! =)