TinyMCE template plugin

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Locked
Anastasis

TinyMCE template plugin

Post by Anastasis »

Looking at the Moxiecode website I see that they say that the installation of TinyMCE comes bundled with a template plugin (see here: http://wiki.moxiecode.com/index.php/Tin ... s/template).

This allows the end-user who is editing the page content to select snippets of predefined page content.

This button/option is not available in the list of plugins available with the TinyMCE I have installed in my CMSMS. I realise that it would also require a source of snippets for the user to browse and select from, but is it possible to incorporate this functionality into the TinyMCE implementation in CMSMS?

An example of how this is implemented can be seen here (it is the third button from the right on the bottom toolbar Image):

http://tinymce.moxiecode.com/example_fu ... ample=true

The content editors/users of our new website which I have planning to build in CMSMS would want to sometimes add custom pre-defined content and this method of managing this for them would be ideal.

Please - can it be done and if so how?

Thanks in advance.
cyberman

Re: TinyMCE template plugin

Post by cyberman »

Anastasis wrote: but is it possible to incorporate this functionality into the TinyMCE implementation in CMSMS?
Its easy - you have to replace TinyMCE version that comes with CMSms module with current TinyMCE version 2.1.1.1. This one contains template plugin ;).
Anastasis

Re: TinyMCE template plugin

Post by Anastasis »

Cyberman - thanks for your answer on this.

I assume that the management of these predefined content templates is integral within TinyMCE - wrongly I had it in my head that this would be to do with CMSMS.

Anyway, as TinyMCE v2.1.1.1 is not available as a module in my version of CMSMS (v1.04), I decided to download the v2.1.1.1 zip file from the TinyMCE website and unzipped it. The folder in the zip is called "tinymce" (all lowercase) and this ties up with the folder of the same name in CMSMS which is located under a folder called "TinyMCE" that also contains some php files and a couple of other folders.

I renamed the old "tinymce" sub-folder and uploaded the new "tinymce" folder to the same location thinking that is all that I needed to do, but now there is no editor showing when editing a page. I have obviously misunderstood something but I don't know what.

Any help on sorting out my TinyMCE configuration to the latest version would be much appreciated.
Anastasis

Re: TinyMCE template plugin

Post by Anastasis »

OK, I have now got it working again.  :)

A search of posts for "tinymce" in the forums threw up a post which suggested that the "Use TinyMCE compression module" option may be an issue. I don't know whether or not it was checked in the v2.0.4 version that I used previously, but unchecking it with v2.1.1.1 made TinyMCE work again. :)

Looking again, the post was by you Cyberman (see http://forum.cmsmadesimple.org/index.ph ... l#msg51112), so thanks for that. :)

All I need now is to work out how TinyMCE allows you to define new snippets of predefined page content as at the moment the combo in the TinyMCE template dialog is not populated (not surprisingly as I haven't defined any) but there is no interface by which to create new ones.
cyberman

Re: TinyMCE template plugin

Post by cyberman »

Anastasis wrote: but there is no interface by which to create new ones.
Right - there's no one. TinyMCE Templates are "simple" html files. You have only to add path to that files inside modules php like that
template_templates : [
{
title : "Editor Details",
src : "editor_details.htm",
description : "Adds Editor Name and Staff ID"
},
{
title : "Timestamp",
src : "time.htm",
description : "Adds an editing timestamp."
}
Please search in source for tinyMCE.init. Your posted moxiecode wiki link helps you to do the right :).
Anastasis

Re: TinyMCE template plugin

Post by Anastasis »

Thanks Cyberman for this.

I had a look on the Moxiecode website re the template configuration. I think I prefer the option to make the list of templates external to the "tinyconfig.php" file by using the "template_external_list_url" parameter. That would then mean editing a smaller simpler file than modifying the large config file every time.

However, although I know this external list file could go anywhere, I am unsure as to the best place to locate this file in the CMSMS site structure. Also, where then to put the actual template files and thereby define the correct relative paths to make the structure flexible.

Currently, I am testing the site in a sub-folder of my site folder, but the site when live will be moved to the root folder of another site URL. Also, there is then the issue that many of the templates will contain links to images (located in uploads/images) so the relatives paths to those also need to be defined correctly so as to be viewable by the editor user.

It would be easier to give everything an absolute path but it feels like that goes against the right way to define them by using relative paths. My head though is a bit frazzled by all of this.

Is anyone using TinyMCE templates in CMSMS? If so, how have you set yours up to be flexible?
Last edited by Anastasis on Wed May 16, 2007 2:28 pm, edited 1 time in total.
tsw
Power Poster
Power Poster
Posts: 1408
Joined: Tue Dec 13, 2005 10:50 pm
Location: Finland

Re: TinyMCE template plugin

Post by tsw »

just a suggestion (and I'm not sure if this works at all) but use template externalizer to export your templates to files. then point tiny to one of those templates.

this way you can edit the template in cmsms admin ;)
mademoisl
New Member
New Member
Posts: 2
Joined: Wed Mar 18, 2009 2:45 am

Re: TinyMCE template plugin

Post by mademoisl »

Hello
Where do we have to put the code

template_templates : [
      {
        title : "Editor Details",
        src : "editor_details.htm",
        description : "Adds Editor Name and Staff ID"
      },
      {
        title : "Timestamp",
        src : "time.htm",
        description : "Adds an editing timestamp."
      }

Thanks
xnau
Forum Members
Forum Members
Posts: 33
Joined: Sun Apr 15, 2007 6:53 pm

Re: TinyMCE template plugin

Post by xnau »

Looks like kindof a dead thread, but I just went through the process of figuring out how this works, so I'll share my findings for anyone who wants to use the template plugin in TinyMCE.

The trick is to place the configuration code in the "Extra configuration" box in the advanced tab in the TinyMCE config page.

I put this in as a test:

Code: Select all

template_templates : [
      {
         title : "simple snippet",
         src : "tinytemplates/snippet.html",
         description : "add a test snippet"
      }
		],
template_replace_values : {
	test : "TEST CONTENT"
}
And snippet.html:

Code: Select all

<p class="test">This is a simple <strong>snippet</strong>. Will be replaced: {$test}.</p>
The path to the template is relative to the web root. There is a suggestion above that you could use Template Externalizer to manage the template, and that would work, but these templates become static once inserted into the content--i.e. you won't be able to change all instances of the template by editing the source template.

This plugin is really just a way to insert complex snippets and give you some variables that will be applied at the time it's inserted. You could, (and I haven't figured this out yet) have a pop-up come in that asked for specific content, then when the snippet was inserted, that content would be placed in the snippet. For instance, if you wanted to add a caption to an image, this plugin would allow you to select the image, type in the caption, and then it would do the job of wrapping the caption and image together.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12709
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: TinyMCE template plugin

Post by Dr.CSS »

This whole tiny template thing has been discussed and resolved in another post, a simple search and most likely this post would have never happened...
User avatar
micahgodbolt
Forum Members
Forum Members
Posts: 149
Joined: Thu Jul 29, 2010 11:09 pm
Location: Portland, OR

Re: TinyMCE template plugin

Post by micahgodbolt »

I did a straightforward how to. Check it out at

http://forum.cmsmadesimple.org/index.php/topic,49098.0.html
Locked

Return to “Layout and Design (CSS & HTML)”