Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jan 2008
    Posts
    334
    Thanks
    9
    Thanked 0 Times in 0 Posts

    How do I make my own BB Code?

    I wanting to make my own BB code. I'm sure a lot you already know what that is but for example. Say I want to change this string here into a url:

    PHP Code:

    $string 
    "[url=http://example.com]http://example.com[/url]"
    And turn that into:


    Code:
    <a href="http://example.com">http://example.com</a>
    What function do I use to do this with? preg_replace, str_replace?

    And could someone give me a idea what are the simple ways of going about this?

  • #2
    New Coder
    Join Date
    Apr 2008
    Location
    Blagoevgrad, Bulgaria
    Posts
    47
    Thanks
    0
    Thanked 8 Times in 8 Posts
    Yes, preg_replace will do the job

    http://bg.php.net/manual/en/function...lace.php#87944

  • #3
    Regular Coder
    Join Date
    Nov 2007
    Location
    Leeds, UK
    Posts
    514
    Thanks
    24
    Thanked 19 Times in 19 Posts
    Quote Originally Posted by er4o View Post
    http://www.desilva.biz/php/bbcode1.html

    Just one difference dont use $GLOBALS[varname] just use $varname
    Working towards a Internet where we don't have website just browser applications Kill the Hyper-link and say hello to 3D Games in the browser :)

  • #4
    Regular Coder
    Join Date
    Jan 2008
    Posts
    334
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Cool thanks guy. I was looking for something like this!


  •  

    Posting Permissions

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