Results 1 to 20 of 20

Thread: [code] Code Here [/code]

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    259

    [code] Code Here [/code]

    I need code to convert code [CODE] CODE HERE [//CODE] to code inside table or textarea .. the code that used in phpbb forum .. Thanks

  2. #2
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    tell me your kidding......

    http://www.vbforums.com/showthread.p...hreadid=184356

    do you not pay attention when we write alllllll your code

  3. #3
    Fanatic Member Gimlin's Avatar
    Join Date
    Dec 2001
    Location
    Hell
    Posts
    734
    we really need a sticky, that has useful links and such...

    like...umm for example PHP.NET

  4. #4
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    lol good one, but he has never been there,

  5. #5
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    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?
    My evil laugh has a squeak in it.

    kristopherwilson.com

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    259

    no M.R The Hobo

    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

  7. #7
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Re: no M.R The Hobo

    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!
    My evil laugh has a squeak in it.

    kristopherwilson.com

  8. #8
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    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

  9. #9
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Re: no M.R The Hobo

    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
    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.

    Originally posted by prokhaled
    if you replace (code) with "<table width=100%><td width=100>"

    and replace (/CODE) with "</TD></TABLE>"
    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."
    My evil laugh has a squeak in it.

    kristopherwilson.com

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    259

    substr_count

    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

  11. #11
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256

    Re: substr_count

    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
    I don't think there is to my knowledge. But I don't know JS functions very well.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  12. #12

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    259

    Ok

    Thanks

  13. #13
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    And just for future reference, it's Mr. Hobo. Not M.R The Hobo.
    My evil laugh has a squeak in it.

    kristopherwilson.com

  14. #14
    Fanatic Member cpradio's Avatar
    Join Date
    Apr 2002
    Posts
    616

    Re: no M.R The Hobo

    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
    If you write a valid preg_replace expression then it will only convert the completed tags meaning areas it finds both the [c&#111;de] text [/c&#111;de] in that order.

    -Matt
    http://cpradio.net/
    Administrator @ WDForums and a Moderator @ WebXpertz City Forums

  15. #15
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    phpman, you = scoutt?
    My evil laugh has a squeak in it.

    kristopherwilson.com

  16. #16
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    what makes you say that?

  17. #17
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by phpman
    http://www.vbforums.com/showthread.p...hreadid=186529

    scoutt

    reg. dec 99
    posts: 2950
    My evil laugh has a squeak in it.

    kristopherwilson.com

  18. #18
    Frenzied Member
    Join Date
    Nov 1999
    Posts
    1,337
    ahh drats, I have been caught

  19. #19
    Fanatic Member cpradio's Avatar
    Join Date
    Apr 2002
    Posts
    616
    lol, Hobo just found out
    http://cpradio.net/
    Administrator @ WDForums and a Moderator @ WebXpertz City Forums

  20. #20
    Stuck in the 80s The Hobo's Avatar
    Join Date
    Jul 2001
    Location
    Michigan
    Posts
    7,256
    Originally posted by cpradio
    lol, Hobo just found out
    It's not like I really cared.

    I just happed to notice. It's not like I try to get the FBI profile of every member...
    My evil laugh has a squeak in it.

    kristopherwilson.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width