TinyMCE Templates: How to make them work

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
User avatar
micahgodbolt
Forum Members
Forum Members
Posts: 149
Joined: Thu Jul 29, 2010 11:09 pm

TinyMCE Templates: How to make them work

Post by micahgodbolt »

Too many threads about this subject, and not enough answers...so here is what I have been able to figure out on this topic.

Step 1: Turn on "template" in the TinyMCE Plugins tab

Step 2: Insert "template" in TinyMCE profiles (backend and advanced probably)

Step 3: In the "Advanced" tab of TinyMCE enter the following into the "Extra Configuration"

Code: Select all

template_templates : [
               {title : "Template Title",
		src : "/absolute-path/to/file/html-template-file.htm",
		description : "Template Description"}
] 
Step 4: create the htlm that you want to use as a template and wrap it in a . Store it at the src location/name stated in step 3.

Step 5: Now you will have an icon on your TinyMCE toolbar marked template. Click that, choose your template from the dropdown. Hit insert and all of that html, including the surrounding divs will be inserted at your cursor location.

So thats it. Pretty simple

Now if someone can tell me how to create variables that the user can define each time they use the template, that'll be peachy  ;)
cyberman

Re: TinyMCE Templates: How to make them work

Post by cyberman »

Thanx for your work - really useful!
Post Reply

Return to “Modules/Add-Ons”