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 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jan 2004
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Switching some strings for other strings.

    Alright, if anyone has ever seen those BBcode systems, you would know that while editing a post, you might have somthing like:

    "[ quote ]blahblahblah[ /quote ]"

    and then when it ould run therough the php it interpreted

    [ quote ]

    as, say:

    <HR>

    and [ /quote ] as another:

    <HR>

    How would I have php import a file, and interpret things like [this] and then render as a completly diffrent html code?

  • #2
    Regular Coder
    Join Date
    Apr 2004
    Location
    Los Angeles
    Posts
    133
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here's one way

    $strFile = file_get_contents($file);
    $strOutput = str_replace("[break]","<br>", $strFile);
    echo("$strOutput");


  •  

    Posting Permissions

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