Time Saving Tuesday

Last Thursday we showed you how to make Windows Live Writer portable, and today we are going to show you how to create powerful text templates that will save you incredible amounts of time. Unfortunately the plugin you’ll need to install, Dynamic Templates, won’t work with the portable version.

Dynamic Templates was created by Joe Cheng who happens to be one of the primary Live Writer developers. For that reason I had expected the plugin to be good, but I didn’t expect it to be this good!

As of two-weeks ago I was using the free Post2Blog software for writing all of my articles, and it had a built-in template manager. It was designed to let users quickly enter in some HTML code that would otherwise be found repetitious. It was limited to doing what Dynamic Templates can do in the first example below, so if the plugin doesn’t seem special from that demo make sure you move on to the others!

Before we get started with the four demonstrations I want to give you a heads up that there is some C# code involved in some of the examples. I’ve never actually programmed in C# before, but I’ve done 7 or 8 other languages so I was quickly able to pick up on the basics. The Dynamic Templates page has some instructions on how to insert the syntax, but you’ll probably learn the ropes from the videos.

–HTML Templates–

This is a basic HTML template that is what most of you will probably want. We use these all the time to insert things we frequently use in posts, such as our daily CyberNotes logo. That way we don’t have to insert the image every time we want to use it.


<p align="center"><a href=""><img alt="CyberNotes" src=""></a><br><strong>Time Saving Tuesday</strong></p>


–Selection Formatting–

The Dyanmic Template plugin has a command, "_selection", that lets you insert the highlighted text anywhere in your template. You might be asking yourself how that would be useful, but I think you’ll be surprised at how many things you can do with it. In this example we show you how to wrap multiple HTML tags around the text that we’ve highlighted thereby creating a one-click colorful header.


<h3><strong><font color="#800000"><%= _selection %></font></strong></h3>


–Selection Processing–

This is using the same "_selection" command mentioned in the previous demonstration, but now it is really starting to tie in some of the C# programming. More specifically this code will send the highlighted text through an HTML filter which will transform any plain text HTML tags into valid HTML.


<%= HtmlDecode(_selection) %>


–Advanced Video Insertion–

This demonstration shows you why I love the plugin so much, but you’ve got to know a little bit of programming to completely understand what it’s doing. Here I setup the plugin to prompt the user for a Google Video ID and the desired width/height for the embedded video. If no dimensions are entered in it will fall back on some defaults which can be designated in the code.

Tip: This code can easily be configured for use with any video service, but sites like YouTube specify the ID, height, and width twice in the embed code. Make sure you replace all necessary instances if you want it to work properly.

Code (there are also a few variables which you can get from the video):

<% if(width == "")width = "400"; %>
<% if(height == "")height = "326"; %>
<embed style="width:<%= width %>px; height:<%= height %>px;" id="VideoPlayback" type="application/x-shockwave-flash" src="<%= ID %>&hl=en" flashvars=""> </embed>



While the plugin is very complete in my eyes there are a few things that could make this even better:

  • Hotkeys! Oh man, it would be really sweet if you could assign hotkeys to some of the templates you use the most often.
  • I would like the option to set the size of the window which lists all of your templates. I have about two-dozen templates, and I don’t really like having to scroll to get to some of them.

To wrap things up Dynamic Templates is a great way to remove the strain of repetitive tasks, but to harness the true power you’ll need to sit down for an hour or so and learn how to write code that works well with it. Believe me, you won’t be sorry!

Dynamic Templates Homepage (Download)