WYSIWYG: Insert Template

By Simon Gentner
April 18, 2015

This is a quick overview on how to setup the Insert Template inside the wysiwyg. This functionality allows you to add templates or HTML snippets of code directly into the wysiwyg. It can be as small as a single line to a multiline piece of code

1) To setup the snippet you first need a folder setup in the system folder called CMS Snippets, then you must also add a folder called Default

2) Now create a a C# developer template inside the Default folder, you can edit and delete the default C# code that is added by the cms for a developer template, also give a good descriptive keword of the snippets as the name of the file as this is what is used in the selection, you may also want to setup a model on the default folder so that it is easier to create future snippets

3) Now in the WYSIWYG you will need to add a param please see the wysiwyg documentation on adding adding params the item here you will be specifically adding is "WysiwygParams.TemplateBrowserOn == true", this should show up in the intellisence

4) Now open your browser and browse to the WYSIWYG, a new icon with a green plus sign shows up, click the button and a popup shows up with the list of files in the default folder, select the desired snippet and then click Insert and close the browser. Your HTML fragment has been inserted where your cursor was located.



Tags:  Blogs, Developers
comments powered by Disqus