Page 1 of 2
Text Formatting
Posted: Fri Mar 05, 2004 12:07 am
by phppick
Hi,
I want Use Textarea with Formatting Options (like Bold, Italic etc etc)
Let say like this textarea in forum 'new topic posting'
Where can i get like this. i want this to be work in multi OS..
Like:
--------
Company Name
Street
Some text ,text text text text text
text text
text
---------
And with paragraphs
Any body can help me??
Thanks
Posted: Fri Mar 05, 2004 3:04 am
by twigletmac
You want the buttons and stuff for adding the bbcode? Have you had a look in the source code of the page?
Mac
Posted: Fri Mar 05, 2004 3:17 am
by JayBird
For something really advanced look at this
http://www.fredck.com/FCKeditor/
for a demo, look here
http://www.fredck.com/FCKeditor/Demo/
Mark
Hi twigletmac - Text format
Posted: Sun Mar 07, 2004 7:40 pm
by phppick
Hi twigletmac
Sorry for cross post.. So, i can download BBCode from sourceforge.net
And main issue is, i am entering some text as Paragraphs in text area. to store it in database i am using datatype 'text' .
But while displaying, its showing as one paragraph. Suppose if paste some content from BBC news website and if contains some 5-6 paragraphs, while displaying it to the user , Its showing as only one paragrpah. All the text in one para..
Can you help me on this??
Posted: Sun Mar 07, 2004 7:49 pm
by tim
i'll give u a example:
Code: Select all
<?php
$sql = "select * from table_name";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
$comment = nl2br($row["comment"]);
?>
focus your attention on the nl2br, this will give your line breaks =]
cheers
Posted: Sun Mar 07, 2004 7:50 pm
by d3ad1ysp0rk
nl2br() function will fix that

Posted: Sun Mar 07, 2004 7:51 pm
by d3ad1ysp0rk
beat me to the punch..

Posted: Sun Mar 07, 2004 8:21 pm
by tim
lol i been beat my fair share of times here...
I hate hitting that edit button!

Thanks
Posted: Sun Mar 07, 2004 11:32 pm
by phppick
Hi,
Thanks for your solution TIM.its working great.
Anyway you have any idea how to Implement BBCODE, in my page? i wnat exactly like in this Forum.. Bold, Italic etc..
Thanks.
Jen
Posted: Mon Mar 08, 2004 1:36 am
by vigge89
before showing the threads and replies, the post goes trough a "format"-function, which changes bbcode into the HTML. you could just use [php_man]str_replace[/php_man], but also [php_man]preg_replace[/php_man] using regexp patterns...
Posted: Mon Mar 08, 2004 4:26 pm
by tim
couldnt have said it better myself.
Posted: Mon Mar 08, 2004 4:42 pm
by tim
on second thought
I remember a post and the guy wanted to do exactly what u wanted, the code and how-tos was on it
search for it if all else fails here.
BBCODE
Posted: Thu Mar 11, 2004 7:40 pm
by phppick
Hi
ANYBODY CAN TELL ME HOW TO USE THIS BBCODE( this Textarea part with Bold and Italic options) Which we use for Posting Replies/Newpost..
Posted: Fri Mar 12, 2004 12:47 am
by vigge89
i already posted how...
Posted: Fri Mar 12, 2004 6:07 am
by patrikG
alternatively, you can use a ubb function on phpclasses.org - it's somewhat buggy and not tremendously effective, but you will get the idea from what is necessary and how to implement it.
Just search for ubb on phpclasses.org.