Please visit my mobile site here.

Your Ad Here

My blog system was build with FCKeditor and I was happily using the default setting until I feel like writing some tutorial about programming.

I will be writing article about programming and will meet circumstances where I need to embed the coding along with the content. You will be agree that programming code looks boring and thus it has to be colourful ;)

So I did some search and found this cool Open source fckeditor plugin: Syntax Highlighter.

Lets try some PHP code here:

function is_alphanumeric($input)
{
    return (preg_match("/^[A-Za-z0-9]+$/i", $input));
}

Then, here goes some javascript code:

// call periodical
$(contentDiv).everyTime(100, function(i)
{
        if (parseInt($(this).css('top'))>(contentDivHeight*(-1)+8))
        {
            // move scroller upwards
            offset = parseInt($(this).css('top'))-scrollSpeed+"px";
            $(this).css({'top':offset});
        }
        // reset to original position
        else
        {
            // reset to original position
            offset = parseInt($(this).parent().height())+8+"px";
            $(this).css({'top':offset});
        }
 });

And the HTML code (with some mix of javascript code in it ):

 

<h2>Documentation</h2>

<p>Include these dependency files to your header.</p>
<code class="html">
<xmp>
    <script type="text/javascript" src="jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="jquery.timers.js"></script>
    <script type="text/javascript" src="jquery.autoScroller.js"></script>
</xmp>
</code>

Last, some dotnet c# code which i will be using quite often in near future:

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MvcApplication2.Helpers
{
    public class LabelHelper
    {
        public static string Label(string target, string text)
        {
            return String.Format("<label for= '{0}'>{1}</label>",target,text);
        }
    }
}

 

OK, let's see how it goes...