browser lang:en
The situation begins with your blog or website and you need to post some code on a particular webpage. In this tutorial, we will assume you want to post some basic HTML sample code (though this method will work with any programming or scripting language) that contains a hierarchy code structure.
Step 1: The Actual Code
You probably already have the first step, and that is obtaining the code you want to display on your website or blog. For this example, we will use the below:
<html>
<head>
<title>my code</title>
</head>
<body>
<p>This is a test</p>
</body>
</html>
Step 2: Code Manipulation
The next important step is to convert special characters to their associated HTML representations. Common examples of this are the greater than (>) and less than (<) symbols often used to distinguish tags. A ‘>’ symbol should be represented as ‘>’ and a ‘<’ symbol is represented as ‘<’. If you code with the actual symbol, the tags will be evaluated and therefore not display properly. The example below is what our example looks like with special symbols replaced with their associated html names.
<html>
<head>
<title>my code</title>
</head>
<body>
<p>This is a test</p>
</body>
</html>
Step 3: Code Formatting
However, if you just post the above code in your HTML while preserving the spaces and carriage returns (line breaks), you will discover the formatting is not properly displayed. In my experience, I find that using the HTML <pre></pre> tag is the best way to achieve the end goal. The text within the<pre> tag simply displays text pre-formatted. This means that formatting such as spaces and carriage returns are preserved. The example:
<pre><html>
<head>
<title>Victor's Programming Aid</title>
</head>
<body>
<p>This is a test</p>
</body>
</html></pre>
Success!
Now, your code will be properly formatted with the correct characters and symbols as well as correctly spaced. Happy coding!
Now,if you dont know how to convert your code, you can convert it with holyguard.net HTML code converter
PHP is one of the most widely used open-source server-side scripting languages that exist today. With over…
in:Scripts and tutorials (0 comments)In a FBML Facebook App, your quick jump menu will require a little tweak to work in FBJS…
in:Scripts and tutorials (0 comments)Every single day, someone, somewhere is discussing something important to your business; your brand, your executives, your…
in:Scripts and tutorials (0 comments)The Singleton Pattern is one of the GoF (Gang of Four) Patterns. This particular pattern provides a…
in:Scripts and tutorials (0 comments)Because of the near-spherical shape of the Earth, calculating an accurate distance between two points requires the use…
in:Scripts and tutorials (1 comments)With this script we can limit the download speed // local file that should be send to the client $local_file…
in:Scripts and tutorials (0 comments)Some hosts disabled the ini setting allow_url_fopen. This also means that the ability to easily grab images…
in:Scripts and tutorials (0 comments)The act to verify if a file exists, is one of more important tasks related to files operations,…
in:Scripts and tutorials (0 comments)
