Last updated March 17, 2014. Created by jerdiggity on June 5, 2009.
Edited by jsruzicka, JuliaKM. Log in to edit this page.

There are a lot of users who may not know the "trick" to getting their PHP/HTML code snippets to show up properly; e.g. "How do I post a line of code that normally looks like <a href="this.php">THIS</a> so that it comes out looking like <a href="this.php">THIS</a> instead of being processed and showing up like THIS?"

The answer is using the <code> tag to post your PHP and/or HTML code on here (or any Drupal site), which not only is really cool but can also be extremely helpful to whoever's helping you out, whether it's in the forums, if you have a support request, an issue, or whatever the case might be. At the same time, it does you no good if you don't know how to make use of it.

Anything you post between <code> and </code> will not be treated like actual "code" -- meaning it will not be processed and end up like this -- but rather it will display a formatted version of the letters, numbers, and characters you type in between the opening and closing code tags (which, incidentally, are <code> and </code>, respectively).

Quick example: normally if you were to post something on this site and within that post you typed in this:
<a href="#some-page-that-does-not-exist">click here</a>
... to everyone who reads the post, it would show up on their screen like this:
click here
... as opposed to the code you actually typed in, which, again, would be this:
<a href="#some-page-that-does-not-exist">click here</a>
And actually, by using the code tags, what you would see (or "type" I suppose) would be this:
<code><a href="#some-page-that-does-not-exist">click here</a></code>
... and what everyone else would see would come out looking like this:
<a href="#some-page-that-does-not-exist">click here</a>

When you surround the text with the code tags, it tells Drupal, "Leave everything inside here the way it is so other people can see it the same way you see it. In fact (while you're at it), make it look nice too, OK?" :)

Hopefully that gives you at least some clue as to how the whole thing works, in the event that you were unaware or even if you were just "not quite sure."

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.