delphi programming forums mysql charset mget recursive synonimos
free ventrilo servers hosting cs javascript delay python find in list
Back Forum New
abstract:

html). Likewise, HTML tags like <p></p> in HTML code are displayed as HTML paragraphs.
So what's the key to displaying raw code? No doubt I am missing something.
Thanks for any tips!


I would like to display samples of code on a web page--both HTML and PHP--but it is not working well. I see examples of code on other sites that work fine, and they are simply wrapped in <code></code> tags.
For example, if I want to display PHP code starting with <?php and ending with ?>, rather than just display as is, the code gets processed and output (if the page is .php) or does not appear (if the page is .html). Likewise, HTML tags like <p></p> in HTML code are displayed as HTML paragraphs.
So what's the key to displaying raw code? No doubt I am missing something.
Thanks for any tips!

TOP

Thanks Kravvitz. That works well.

TOP

Besides using entities for reserved special characters, you will likely want to wrap the code in the pre element, a block level container.
Code:
  1. <pre><code>
  2.       <form action="foo"
  3.             method="post">
  4.         <fieldset>
  5.           <legend>first group</legend>
  6. </code></pre>
Copy Code
cheers,
gary

TOP

Thanks for that Gary. I tried this, and using the pre tags certainly produced a nicer result (I was also able to do away with some br tags as well).
Then I tried just using the pre tags without the code tags, and that produced the same result.
So what's the point of using the code tags at all?

TOP

abstract:

html). Likewise, HTML tags like <p></p> in HTML code are displayed as HTML paragraphs.
So what's the key to displaying raw code? No doubt I am missing something.
Thanks for any tips!


Thanks Kravvitz. That makes sense.

TOP

Back Forum