TinyMCE Talk:Plugins/template
From Moxiecode Documentation Wiki
I am finding configuration of the template plugin to be quite finicky.
Contents |
Retrieving a list of templates
Using a relative url relies on tinyMCE.documentBasePath which it seems can only be set (using document_base_url) if you have relative_urls:true. So in theory, to use a relative url you would either make your url relative to the page on which the editor resides, or set relative_urls:true and document_base_url and make it relative top that. You can set document_base_url even with relative_urls:false, but the value is ignored by tiny. In my case I intentionally have relative_urls:false and so using an absolute url is pretty much my only option. This is not too much of a problem because I can generate the absolute url in my webapp so that it is appropriate for wherever it happens to be deployed.
Template locations
Similar comments to those above apply only it is not as trivial to generate absolute urls in template_list.js. Relative urls are again relative to the page on which the editor resides - it so happens that the way my webapp is structured I can get away with this, but others may not have it so easy. An alternative would be to use template_templates rather than template_external_list_url so as to be able to again generate absolute urls in the webapp.
Templates that use named anchors
I have a template that introduces a named anchor (e.g. #contentTop). This seems to work okay and the anchor appears in the bookmarks. I have another template that introduces a link to the previously inserted named anchor - this is screwed up because tiny puts document_base_url in front of the # and I end up with something like http://example.com/mypages/#contentTop. This looks like a bug to me.
--Seade 07:16, 5 June 2007 (CEST)
Replace values
The replace values feature is great if you want to substitute some values into the text of the content, but I have a situation where I want to substitute some values into the html itself, specifically I want to substitute in a unique value for the id attribute of some inserted content. I am thinking that perhaps some further mechanism might be added to support this. Perhaps a special class prefix could be decoded to allow for this - e.g. class="replaceAttridmyIdVar" could be decoded to replace the attribute of the current element named "id" with the replacement for "myIdVar" (prefixAttr and suffixAttr would be similarly useful).
--Seade 16:35, 7 June 2007 (CEST)
