How to Post Source Code?!

It will be cool right if we can add the source code of any programming language in this blog… Do you know how to do it?!! Ok.. Actually this trick is given by wordpress perhaps some of us not realize this thing…

$host="localhost";
$username="root";
$password="";
$databasename="KTCI_DATABASE";
$link=mysql_connect($host, $username, $password) or die("Database is not connected!");
$selectdb = mysql_select_db($databasename, $link)or die("Database is not selected!");
?>

Wrap your code in these tags: [sourcecode language=’css’]…[/sourcecode]. You can replace the language with “css” with the language that you’re writing in. Currently we support syntax highlighting for the following language codes:

  • cpp
  • csharp
  • css
  • delphi
  • java
  • jscript
  • php
  • python
  • ruby
  • sql
  • vb
  • xml

The language attribute is required! If we don’t have what you need pick the closest.
Code in between the [sourcecode] tags will automatically be encoded for display, you don’t need to worry about HTML entities or anything.

Taken from: http://faq.wordpress.com/2007/09/03/how-do-i-post-source-code/

~ by gedemahendra on September 5, 2007.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: