Are you just wanting to be able to indent text?
Code:
// Query stuff
// No Carriage returns. Remove extra newlines. Put HTML at newlines.
// Append and Prepend HTML. Fix quotes.
$data['body'] = preg_replace('/[\\r]/', '', $data['body']);
$data['body'] = preg_replace('[\\n]', "\n</p>\n<p class='submissionbody'>\n", $data['body']);
// The character will keep the line size
$data['body'] = preg_replace('/(\<p)(\\040)(class\=\'submissionbody\'\>)(\\n{1,})?(\\040{1,})?(\\n{1,})?(\<\/p\>)/', "<p class='submissionempty'>\n \n</p>", $data['body']);
$data['body'] = "<p class='submissionbody'>".$data['body']."</p>";
$data['body'] = stripslashes($data['body']);
$data['body'] = "<div class='submission'>".$data['body']."</div>";
echo $data['body'];
I like this method because it allows everything to be controlled with CSS. It offers a slightly more flexible approach than using the for tabs or the plain nl2br function. It also properly formats the paragraphs -- using spacing properties instead of HTML and puts text inside of paragraph tags. This method is still experimental for me, but I've found it works in 99% of user-submitted texts.
Throw in a few CSS rules to format..
p.submissionbody {
text-indent: 20px;
}
p.submissionbody:first-letter {
text-transform: uppercase;
}
: )
Rich
::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::