Alex,
why should it not be possible? I will go and find out for you, I did at the german website.
After breakfast, ok?
Alex, see how you can manage it:
1)
the standard editor installation already contains the editor-plugin "templates" in the directory
/admin/template/js/ckeditor/plugins
2)
you have to activate that plugin.
2a)
define the path to a custom config-file for the editor:
Code:
define('GSEDITOROPTIONS', "customConfig : '../../../../theme/gs.js',skin: 'getsimple'");
this example defines the custom-config-file
gs.js in the folder
/theme plus the skin for the editor
2b)
activate the extra-plugin "
templates" in that custom-config-file, I stripped off all other definitions...
Code:
CKEDITOR.editorConfig = function( config )
{
config.extraPlugins = 'fileicon,video,syntaxhighlight','templates',
};
3)
when this is done, you have to define the templates which you want to use:
3a)
activate the templates-icon in
gsconfig.php in "editortools":
Code:
define('GSEDITORTOOL',"['Source','Cut','Copy','Paste','PasteText','PasteFromWord','Undo','Redo','Find','Replace','SelectAll','RemoveFormat'],
'/',
['Bold','Italic','Underline','Strike','Subscript','Superscript','JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'],
['TextColor','BGColor','Rule','PageBreak'],['NumberedList','BulletedList','Outdent','Indent'],
'/',
['Blockquote','Smiley'],['Link','Unlink','Anchor'],
['Image','Flash','video','fileicon','Table','HorizontalRule','SpecialChar'],
'/',
['Styles','Format','Font','FontSize'],['ShowBlocks'],['Code'],['Templates']
");
3b)
there is a file
default.js already in the folder
/admin/template/js/ckeditor/plugins/templates/templates which contains already definitions
3c)
to show better the structure of this file, where the definition is joined together and by this quite unreadable, I cut the definition into a readable form:
Code:
CKEDITOR.addTemplates('default',
{imagesPath:CKEDITOR.getUrl(CKEDITOR.plugins.getPath('templates')+'templates/images/'),
templates:[
{title:'Image and Title',
image:'template1.gif',
description:'One main image with a title and text that surround the image.',
html:'<h3><img style="margin-right: 10px" height="100" width="100" align="left"/>Type the title here</h3><p>Type the text here</p>'},
{title:'Strange Template',
image:'template2.gif',
description:'A template that defines two colums, each one with a title, and some text.',
html:'<table cellspacing="0" cellpadding="0" style="width:100%" border="0"><tr><td style="width:50%"><h3>Title 1</h3></td><td></td><td style="width:50%"><h3>Title 2</h3></td></tr><tr><td>Text 1</td><td></td><td>Text 2</td></tr></table><p>More text goes here.</p>'},{title:'Text and Table',image:'template3.gif',description:'A title with some text and a table.',html:'<div style="width: 80%"><h3>Title goes here</h3><table style="width:150px;float: right" cellspacing="0" cellpadding="0" border="1"><caption style="border:solid 1px black"><strong>Table title</strong></caption></tr><tr><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td></tr><tr><td> </td><td> </td><td> </td></tr></table><p>Type the text here</p></div>'}
]
}
);
3d)
you can delete these examples and add your own definitions, here is the definition from our installation at get-simple.de:
Code:
// Register a template definition set named "default".
CKEDITOR.addTemplates( 'default',
{
// The name of the subfolder that contains the preview images of the templates.
imagesPath : CKEDITOR.getUrl( CKEDITOR.plugins.getPath( 'templates' ) + 'templates/images/' ),
// Template definitions.
templates :
[
{
title: 'Hinweis',
image: 'lightbulb.gif',
description: 'Hinweis mit Glühbirne',
html:
'<p class="hinweis"><strong>' + '<img alt="enlightened" class="ohne-border" height="20" src="http://www.get-simple.de/admin/template/js/ckeditor/plugins/smiley/images/lightbulb.gif" title="enlightened" width="20" /> Hinweis</strong>: ÜberschreibediesenText.' + '</p>'
},
{
title: 'In der Presse',
image: 'newspaper.png',
description: 'Für die Presseliste',
html:
'<H2>ÜberschreibediesenTextmitTitel</h2>' + '<p>LinkzuArtikel</p>'
},
{
title: 'DefinitionList',
image: 'definitionlist.gif',
description: 'Zum Erzeugen von Definition-Listen.',
html:
'<dl>' + '<dt>Begriff' + '<dd>Erklärung</dd>' + '</dl>'
},
{
title: 'Definitionlisten-Eintrag',
image: 'definitionlist.gif',
description: 'Um weitere Definitionen einzufügen',
html:
'<dt>nochein Begriff' +
'<dd>noch eine Erklärung</dd' + '</dt>'
}
]
});
3f)
each template needs_
- title
- image
- description
- html for the output
4)
4a)
when you have defined all this, you will see a symbol for templates:
4b)
click on this symbol and you will see the defined templates to choose from:
4c)
click on one of these templates any you will get the code into your write-aread:
4d)
in our case the template creates a info-message, and it contains already some dummy-text "überschreibediesentext", so it is easy to click on this dummy-text and write your own text
if this info helps you and is clear, we can add it to the WIKI ;=)