Gabe Sumner

Gabe Sumner

The RSS Feed URL cannot be found!
The remote server returned an error: (400) Bad Request.

Back to all posts

Sitefinity "Format Code" Control

Posting code samples on web pages sucks.  Much of the nice formatting that makes code readable gets completely lost when you toss it into HTML.  What you end up with looks like modem line noise.

To combat this, I wanted to create a Sitefinity control that would easily allow me to post nicely formatted code samples to my web pages.  This ended up becoming a fairly complex project. 

To see full information & download details about this control, click here.

Sorry I have to direct you to a new page.  Sitefinity Blogs do not allow controls.  This is beginning to limit what I can do with these blog entries.  This is a subject that has been discussed on the Sitefinity forums

UPDATE: It turns out RadEditor has a very handy "Format Code Block" feature that does this very same thing.  So basically, I just wasted a fair amount of time because I didn't RTFM!  :)  To make use of this you need to add the following bit of code:

<tool name="FormatCodeBlock" enabled="true"/> 

Into the ~/Sitefinity/Admin/ControlTemplates/EditorToolsFile.xml

If you want to witness my complete disgrace on this, then you can look at the following forums' thread:

http://www.sitefinity.com/support/forums/support-forum-thread/b1043S-bamacd.aspx

My thanks to Ben & Sean for hitting me with a clue-by-four.  I am still going to leave my "Format Code" control available for download however.  At the very least, it does demonstrate a working Control Designer.

Facebook DZone It! Digg It! StumbleUpon Technorati Del.icio.us NewsVine Reddit Blinklist Furl it!

Comments  3

  • Sean Molam 12 Nov, 07:57 PM

    Gabe,

    Couldn't you just use the Format Code block option of the RadEditor?

    Then there is no need for the control and rather enable this option for Generic Content?


  • Gabe Sumner 13 Nov, 09:58 AM

    Sean, the answer is "yes, you could just use the RadEditor" solution. I [stupidly] overlooked this feature. I updated the blog entry above to contain the details. Thanks for the comment.


  • hotel bewertungen 15 Jan, 12:25 AM

    Capacity Economic,husband equipment advise role train certainly alone component energy ring fast suffer average proposal air condition alone week with fact legal soldier imagine request through call engine stock door narrow ministry inside curriculum path bring bed hope but threat miss fee address plenty wish grant content employment little alternative pull bag sale provided farmer resource gain ministry publication difficult below damage money trouble worth conference bottle jump safety rock report wear move least rain transfer flat balance partly victim weapon even half vehicle tradition describe concern retain rapidly white visitor control address control employ


Post a comment!


HostMySite.com   website uptime