Sunday, February 13, 2011

HTML Combiner -- a small utility for inserting HTML into multiple pages

No doubt if you've worked on websites before you've wanted to reuse common blocks of HTML code across multiple pages -- such as the link bar on the right of this page. Normally you could accomplish this through Server Side Includes (for pure HTML), iframes, or even Javascript. Now my web hosting plan doesn't support SSI, and after reading about the downsides of iframes I'm not very ecstatic about using them either. Finally, I can't see myself using Javascript just for a links bar -- if someone has it disabled then they can't navigate my site!

So, wanting an excuse to write some C# code, I wrote a small utility that allows you to reuse HTML code by inserting tags throughout your website. The program then inserts your block of code where those tags appear in a the pages you want. In fact, I've been using it across my website for the links bar and also some statistics tracking scripts. Here is a screenshot of the main screen

Hoping that someone else might get some use out of it, I've put it up for download on its own page and submitted it to several software download sites. I haven't distributed my own programs since 2007, so it was an interesting process. In fact, it reminded me of a nice fact:

Programming is easy. Releasing software is hard

I have a very simple utility, but I have to put up with quite a few issues:

  1. Making sure there are error handlers everywhere
  2. Setting up an installer (an adventure in itself
  3. Targeting a version of .NET that is widespread (I chose 2.0)
  4. Writing a help file
  5. Building the product website
  6. .... (more) ....
Actually it took me a good 6-7 hours to finish everything, and there are still alot of things I need to add. But it's up now, so I'll be able to add to it pretty easily.
That's all for today -- in my next post I'm going to talk about my recent experiences with adding integration testing and also my attempts at unit testing methods that are heavily dependent on FileStreams.

No comments:

Post a Comment