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 /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Tinymce: template button doesn't insert the content of my template

Go to End

4 Posts   1001 Views


Community Member, 24 Posts

13 February 2014 at 6:02am


I am trying to customize the tinymce in the CMS in order to be able to enter small html templates that are of the following form:

<div class="my-note">
	enter the text of your note here

without toggling to html edition.

I put this in mysite/_config.php

HtmlEditorConfig::get('cms')->addButtonsToLine(2, 'template'); 

then I wrote the following templates in mysite/templates/


<div class="my-note"> enter the text of your note here

and similar for listing.html and code.html

Then I visited mysiteadress/dev/build
and mysiteadress/admin/?flush=all

I have a button in the editor toolbar that allow to open a window and to chose the template.
But what is injected in my page is not the template but
<p> enter the text of your note here</p>
I don't understand why I have my text in paragraph instead of the div I put into the template?

Thank you for help.


Community Member, 24 Posts

13 February 2014 at 8:16am

I eventually had it working

I don't yet understand clearly but it has something to do with a line in my _config.php

HtmlEditorConfig::get('cms')->setOption('valid_elements', '*
  • ');

At the beginning I had this line added with a long list of accepted tags but without div. I tried to add div but it was still not working. Thus I changed the list with '*

  • ' and It worked.
    But what I don't understand is why when I completely remove the line it goes on working ?!


Community Member, 46 Posts

13 February 2014 at 1:36pm

Important to note is that config changes do not take effect until you do a complete page load. AJAX loads don't refresh the config, no matter what you've changed in the code. So in normal use, since SS uses AJAX for all page loads, the config will never refresh after first logging in.

I, at least, have found no way around this.

It may explain that last concern you voiced, and perhaps also some others.


Community Member, 24 Posts

13 February 2014 at 8:53pm

Thank you Sygmoral

I have taken notice.