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 /

TinyMCE Templates not working under 2.4? (solved)


Reply


4 Posts   1395 Views

Avatar
Ironcheese

Community Member, 33 Posts

19 June 2010 at 4:31am

Edited: 19/06/2010 10:08am

Hi everyone,

in my company we are using the TinyMCE template feature in Silverstripe 2.3 and it works great =)

If I add it in 2.4 the way i added it in 2.3 the template wont show up in the popup. instead i see the errorpage of my website. oO?

Is there another way to add this template feature to TinyMCE or any work around?

thanks in advance

Avatar
Ironcheese

Community Member, 33 Posts

19 June 2010 at 10:08am

I found the problem:

In SilverStripe 2.3 it works like this:

'template_templates' => array(
array('title'=>"my Template",'src'=>"themes/...

In 2.4 you HAVE to use an Slash prefix!

'template_templates' => array(
array('title'=>"my Template",'src'=>"/themes/...

cheers!

Avatar
Ctr

Community Member, 6 Posts

9 August 2010 at 4:29pm

I'm trying to get this to work and was hoping you could share with me the file path you were using (was it in mysite/_config.php?) or did you use the MyLeftAndMainDecorator.php workaround famous here:
http://open.silverstripe.org/ticket/4390?

Also can you include the entire code snippet, I'm trying this without success:

HtmlEditorConfig::get('cms')->setOption('template_templates','title[Title Here]|src[themes/mytheme/path/layout1.htm]|description[some description text]');
This gives me an error message, which is more than what i get if i do:
HtmlEditorConfig::get('cms')->setOptions(array('template_templates'=>array('title'=>'Title Here','src'=>'themes/mytheme/path/layout1.htm','description'=>'some description text');

Any help would be very much appreciated!

Avatar
Ctr

Community Member, 6 Posts

9 August 2010 at 5:21pm

I was lacking an array() level:

HtmlEditorConfig::get('cms')->setOptions(array('template_templates'=>array(array('title'=>'Title Here','src'=>'themes/mytheme/path/layout1.htm','description'=>'some description text'))));

And it is in the MyLeftAndMainDecorator.php file otherwise it is overwritten.

Thanks for your code snippet Ironcheese it saved my day!