This is in reference to enabling the 'Insert predefined template content' functionality/plugin for TinyMCE in Umbraco 4.
Although using this functionality maybe a little controversial, it does have it's uses. In particular, if you want to allow the user to inject a two/three col layout in to a single RTE.
Configuration
Open "/config/tinyMceConfig.config" and add the following sections.
Commands
<command>
<umbracoAlias>Templates</umbracoAlias>
<icon>images/editor/template.gif</icon>
<tinyMceCommand value="" userInterface="true" frontendCommand="template">template</tinyMceCommand>
<priority>76</priority>
</command>
Note: ensure the number in the <priority> tag is not already being used. If it is, change it to the next consecutive number.
Plugins
<plugin loadOnFrontend="true">template</plugin>
CustomConfig
Add this key in the customConfig section. Note the apostrophe at the beginning and after and, the missing one after '400. These are required as Umbraco wraps the keys with apostrophes as it builds the TinyMCE JS file. This will create an empty entry for the "nonexistingkey", and inject the templates configuration after that.
<config key="nonexistingkey">
<![CDATA[',
template_templates:[
{
title : "Two Column",
src : "/home/TwoCol.aspx",
description : "Two Column layout"
}],
template_popup_height : '400]]>
</config>
Edit Rich Text DataType
The last thing you will need to do is go the DataTypes tree in the Developer section and edit the Rich Text Editor datatype and tick the icon next to Template. This ensures it appears in your Tiny MCE instance.
Recycle application pool / touch web.config to see the changes in the tinyMceConfig.config propogated.
Problems
If you have problems getting the template functionality to work, i.e. the Rich Text Editor apprears to break, then try including all of the above on one line as it is very delicate. If that fails, then look for errors in the Firefox Error Console as this might point you to the JavaScript error that might be generated once Umbraco wraps up the config in other JS code required for TinyMCE.
Creating templates
Basically change the 'src' parameter in the customconfig to point to any template you wish to use.
The example above points to a page called 'home' and then loads in the alternative template 'Two Col'. This approach allows you to edit the template via Umbraco.
TwoCol.aspx
<div class="fc">
<div class="fl halfish">
<p>Some content</p>
</div>
<div class="fl halfish">
<p>Some content</p>
</div>
<div>
You can also, of course, just add a plain html file as your template.
Disclaimer
This approach shouldn't be used to replace the umbraco templating system, only enhance the flexibility to the user.