Text Formatting
Moderator: General Moderators
Say is supposed to become Hello World.
Step 1.
Create a form with a textarea.
Step 2.
Submit it to your php-script
Step 3.
In your php-script, use str_replace to replace with
Step 4.
Do a test run.
Step 5.
Pat yourself on the back
Step 6.
Drink a cup of tea and smile.
Step 7.
Have a look at the GUI (graphical user interface) that this forum uses, look at the source code - it's all open source, find out how they do and use the bits you like, or all of it, or none at all.
Voila.
P.S.: And yes, if you read through the thread, all this was posted before.
Code: Select all
їb]hello world!ї/b]Step 1.
Create a form with a textarea.
Step 2.
Submit it to your php-script
Step 3.
In your php-script, use str_replace to replace
Code: Select all
"їb]Hello Worldї/b]"Code: Select all
<b>Hello World!</b>Do a test run.
Step 5.
Pat yourself on the back
Step 6.
Drink a cup of tea and smile.
Step 7.
Have a look at the GUI (graphical user interface) that this forum uses, look at the source code - it's all open source, find out how they do and use the bits you like, or all of it, or none at all.
Voila.
P.S.: And yes, if you read through the thread, all this was posted before.
actually, what version of PHP are u running? if its the newest(5) u can probably use stri_replace...
I never used the function cause i'm on an older version, but if its anything like str_replace, you'll be in the gold. and also another note.
atleast make an effort to find code and not want everyone to create it for you.
I never used the function cause i'm on an older version, but if its anything like str_replace, you'll be in the gold. and also another note.
atleast make an effort to find code and not want everyone to create it for you.
If you're not too familiar with PHP it can be quite difficult to patch together something coherent from little odd bits of functions and manual-references. phppick wasn't asking for someone to write him a complete script, he simply did not understand how to make sense out of all the patchwork comments.tim wrote:atleast make an effort to find code and not want everyone to create it for you.
blah
i'll get you started on the php side.
seeing str_replace is case sensistive, thats why you will have to create the and statements. (like I said, stri_replace is case insensitive)
or if you feel really picky and have an older version, you can test your regular expression knowledge and create something using eregi_replace.
as for the textarea and the html side, i hope you can fend for yourself.
i'll get you started on the php side.
Code: Select all
<?php
$old = array('[ b ]', '[ /b ]', '[ b ]', '[ /b ]', '[ i ]', '[ /i ]', '[ i ]', '[ /i ]'); //note to not have spaces after the first [ n before the last ] n each statement (i had to do so cause without them, the board would now show them
$new = array('<b>', '</b>', '<b>', '</b>', '<i>', '</i>', '<i>', '</i>');
return str_replace($old, $new, $string);
?>or if you feel really picky and have an older version, you can test your regular expression knowledge and create something using eregi_replace.
as for the textarea and the html side, i hope you can fend for yourself.
Thank You Very Much
Hi Guys,
Its working great.. Thank you all, patrik, tim etc..
Thanks
Its working great.. Thank you all, patrik, tim etc..
Thanks