I need code to convert code [CODE] CODE HERE [//CODE] to code inside table or textarea .. the code that used in phpbb forum .. Thanks
Printable View
I need code to convert code [CODE] CODE HERE [//CODE] to code inside table or textarea .. the code that used in phpbb forum .. Thanks
tell me your kidding......:mad:
http://www.vbforums.com/showthread.p...hreadid=184356
do you not pay attention when we write alllllll your code
we really need a sticky, that has useful links and such...
like...umm for example PHP.NET :p :D
:D lol good one, but he has never been there, :rolleyes:
I was hoping no one answered his same question again. Good job! :)
I wonder if he'll ever realize that if he replaces the word "color" in that other post with the word "code" and takes out a few other small things, he'll have exactly what he's looking for? :p
You are mistake
the problem that code contain form many lines and I want to replace new line "\n" with "<br>
and after that replce [code] .. if you test that .. you will see that <br> appear inside <textarea> .. so you must not replace new line "\n" that beetween (Code) and (/Code) with <BR> .. that is the frist problem
____________
second problem .. if you replace (code) with "<table width=100%><td width=100>"
and replace (/CODE) with "</TD></TABLE>"
what if user do not close code with (/CODE) ? the page will not seem good
Hey, I just found this cool link: http://www.php.net/
They have this thing called a manual. It's documentation on all the PHP functions. It's really cool!
what you are asking has nothing to do with replacing text inside of [code] tags.
use ereg_replace();
that is all I will help you. hell search these forums and you will see that has been asked before. also like I said, what in the hell are you making, a 1.3 TB file :rolleyes:
Then you're going to have to go step by step through your text (I posted an example of how to do this in another one of your threads) and parse only the stuff not in (code)(/code) tags.Quote:
Originally posted by prokhaled
and after that replce [code] .. if you test that .. you will see that <br> appear inside <textarea> .. so you must not replace new line "\n" that beetween (Code) and (/Code) with <BR> .. that is the frist problem
Use the substr_count() function to count the number of (code)'s and the number of (/code)'s in the text. If they are not equal, take the user back to whatever they were doing with a message saying "Not all tags are closed."Quote:
Originally posted by prokhaled
if you replace (code) with "<table width=100%><td width=100>"
and replace (/CODE) with "</TD></TABLE>"
that is good Idea .. is there any function in JavaScript like substr_count in php .. that until tell user that the tags is not equal before submit
Thanks
I don't think there is to my knowledge. But I don't know JS functions very well.Quote:
Originally posted by prokhaled
that is good Idea .. is there any function in JavaScript like substr_count in php .. that until tell user that the tags is not equal before submit
Thanks
Thanks
And just for future reference, it's Mr. Hobo. Not M.R The Hobo.
If you write a valid preg_replace expression then it will only convert the completed tags meaning areas it finds both the [code] text [/code] in that order.Quote:
Originally posted by prokhaled
second problem .. if you replace (code) with "<table width=100%><td width=100>"
and replace (/CODE) with "</TD></TABLE>"
what if user do not close code with (/CODE) ? the page will not seem good
-Matt
phpman, you = scoutt?
what makes you say that?
Quote:
Originally posted by phpman
http://www.vbforums.com/showthread.p...hreadid=186529
scoutt
reg. dec 99
posts: 2950
ahh drats, I have been caught :p
lol, Hobo just found out :p
It's not like I really cared.Quote:
Originally posted by cpradio
lol, Hobo just found out :p
I just happed to notice. It's not like I try to get the FBI profile of every member...