Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

SS3 tinymce templates help


2 Posts   766 Views


Community Member, 153 Posts

11 March 2013 at 2:57pm


I'm currently trying to create a tinymce 'templates' module to allow html templates and snippets in your content.

I refer to this article from 2010

I have the template button working fine, but as it retrieves the html file it is inserting my page content and not the html I've selected.

I'm running out of ideas here but it would be nice to finish this off.

Here is my code:



class tinymceTemplates extends LeftAndMainExtension{

function init() {

   //tinymce plugins   

  • ');
  • ');
       HtmlEditorConfig::get('cms')->setOptions(array('template_templates' => array(
          'title'=>'Two columns','src'=>'$BaseURL/tinymceTemplates/templates/columns-2.htm','description'=>'A two column layout'


<div class="row">
   <div class="2-col">column one</div>
   <div class="2-col">column two</div>




Optic Blaze

Community Member, 165 Posts

13 April 2013 at 10:34am

Edited: 13/04/2013 8:56pm

Hi there,

There is a easier way to do this.

1) Insert the following code into you _config.php file:


// Enable template plugin in the WYSIWYG editor//
HtmlEditorConfig::get('cms')->insertButtonsAfter('tablecontrols', 'template');

//Specify location of your snippets//
array('title'=>'3 Columns','src'=>'mysite/templates/3col.html','description'=>'3 Column template'),
array('title'=>'2 Columns','src'=>'mysite/templates/2col.html','description'=>'2 Columns template'),
array('title'=>'1 Column','src'=>'mysite/templates/1col.html','description'=>'1 column template'),

2) Then under the mysite folder create a folder called templates.
3) In the templates folder create your snippet html this example they should be called 3col.html, 2col.html, 1col.html
4) Run a dev build and refresh the cms
5) In the CMS you should now have a new button (see screen shot) when you click it, it will give you a drop down menu of your snippets that you can insert anywhere in the document

Attached Files