Codeblock formatting issue

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ziycon
    Contributor
    • Sep 2008
    • 384

    Codeblock formatting issue

    I'm adding the functionality to a site to output code in messages, I have a problem keeping the formatting that the code was entered in.

    For example:
    Code:
    <html>
    <head>
    <title>test</title>
    </head>
    <body>
          test
    </body>
    </html>
    The code is being put through htmlspecialchar s() so that it will display, how can I keep the formatting when outputting this code?
    Last edited by Markus; Apr 21 '10, 10:57 AM. Reason: Moved from PHP to HTML
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Hi, Ziycon.

    You can overcome this problem by using the <pre> HTML element.

    Comment

    • ziycon
      Contributor
      • Sep 2008
      • 384

      #3
      Thanks for that, I was going to use pre but thought that the htmlspecialchar s() was removing formatting. Thanks for the help.

      Comment

      Working...