Page 2 of 2

Posted: Tue Mar 16, 2004 2:55 am
by phppick
Hi vigge89

" i already posted how "

i am unable to Find where it is?? can you please help.

Thanks

Posted: Tue Mar 16, 2004 3:31 am
by patrikG
Say

Code: Select all

їb]hello world!ї/b]
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

Code: Select all

"їb]Hello Worldї/b]"
with

Code: Select all

<b>Hello World!</b>
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.

Posted: Tue Mar 16, 2004 7:58 am
by tim
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. :evil:

Posted: Tue Mar 16, 2004 8:03 am
by patrikG
tim wrote:atleast make an effort to find code and not want everyone to create it for you. :evil:
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.

Posted: Tue Mar 16, 2004 8:20 am
by tim
okay patrik.

Posted: Tue Mar 16, 2004 8:53 am
by tim
blah

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); 
?>
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.

Thank You Very Much

Posted: Wed Mar 17, 2004 10:06 pm
by phppick
Hi Guys,

Its working great.. Thank you all, patrik, tim etc..

Thanks

Posted: Thu Mar 18, 2004 3:04 am
by patrikG
:)

Posted: Thu Mar 18, 2004 9:59 pm
by tim
welcome.