SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    May 2004
    Location
    London
    Posts
    155
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wink a forum style text editor .....issue

    Hi

    I want a system on my site similarly to here where people enter their snippets of code into a formís text field. On submitting the form their code is previewed on the next page.

    Of course the issue with this is to change angled brackets on any html tags to their special character equivalents. Thatís fine since Iím using php and can therefore use the htmlspecialchars() function.

    However what Iím not sure about is how to tackle the issue of linebrakes. ie. if someone presses return so as to make a line break how do I put something into the text their writing that then renders a proper <br /> on the web page that shows the text theyíve written?

    Of course at the same time if they type <br /> as part of their code for preview that must be be changed to special characters.

    This actual post show's exactly what I want........line brakes when required but then a <br /> showing when I want display that literally.

    Hope someone can help.

  2. #2
    A Smarter Way to Web! zivo's Avatar
    Join Date
    Aug 2003
    Location
    Chicago
    Posts
    433
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Text editor

    Are you looking for something like this?

    http://www.fckeditor.net/

    mp/m

  3. #3
    SitePoint Zealot
    Join Date
    May 2004
    Location
    London
    Posts
    155
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Zivo thanks for your reply.....

    I had a look at fckeditor and tried the demo....while it does change angled brackets to their special character equivalents it doesn't make line breaks if you press return when typing.

    for example I typed the following:
    <table>
    <tr>
    <td>
    Hello
    </td>
    </tr>
    </table>

    and it previewed as

    <table><tr><td>Hello</td></tr></table>

    Anyone any ideas


Bookmarks

Posting Permissions

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