Let's continue what we started in this post & see more tags & markup for use in HTML & on bbPress powered forums.
The code tag is used to display codes in posts (HTML, Javascript, PHP, etc), its function is similar to the use of the [code] tag in bbCode.
There are two options to wrap the codes, the first is by using the <code> tag, & the second uses the back ticks "`", it's better to use these last because the first tag is a HTML tag, & as you'll going to use it to wrap "HTML", some conflicts may occur; in the other hand the back ticks "`" are used as special coding in bbPress forums, in fact they they are not part of HTML markup.
Let's see an example:
<code><script type="text/javascript">
<!-- alert("Hello world!"); //-->
</script></code>
(notice the forward slash "/" in the last part)
or
`<script type="text/javascript">
<!-- alert("Hello world!"); //-->
</script>`
would look:<script type="text/javascript">
<!-- alert("Hello world!"); //-->
</script>
Now let's suppose the code you want to insert contains the <code> tag in it, that would lead to a conflict & an error in the final message, that's why it's better to use the "`" instead ... example:
<code><code><img src="http://www.google.com/intl/en_ALL/images/logo.gif" /></code></code>
Would look like this:
<img src="http://www.google.com/intl/en_ALL/images/logo.gif" />The second <code> tag was omitted, but if you use the back ticks instead:
`<code><img src="http://www.google.com/intl/en_ALL/images/logo.gif" /></code>`
The result would be this:
<code><img src="http://www.google.com/intl/en_ALL/images/logo.gif" /></code>
0 comments:
Post a Comment