1
在Plone 5中,您可以通過註冊模板插件來使用TinyMCE編輯器中的html模板。這些模板是生活在文件系統中的html片段,它們也在plone資源註冊表中註冊。這裏是一個例子:如何在Python代碼或TAL中訪問TinyMCE模板?
<?xml version="1.0"?>
<registry>
<record name="plone.templates" interface="Products.CMFPlone.interfaces.controlpanel.ITinyMCESchema" field="templates">
<field type="plone.registry.field.Text">
<default></default>
<description xmlns:ns0="http://xml.zope.org/namespaces/i18n" ns0:domain="plone" ns0:translate="help_tinymce_templates">
Enter the list of templates in json format http://www.tinymce.com/wiki.php/Plugin:template
</description>
<required>False</required>
<title xmlns:ns0="http://xml.zope.org/namespaces/i18n" ns0:domain="plone" ns0:translate="label_tinymce_templates">Templates</title>
</field>
<value>[
{"title": "Template 1", "url": "++theme++mytheme/tinymce-templates/tmpl1.html"},
{"title": "Template 2", "url": "++theme++mytheme/tinymce-templates/tmpl2.html"}
]</value>
</record>
<record name="plone.custom_plugins" interface="Products.CMFPlone.interfaces.controlpanel.ITinyMCESchema" field="custom_plugins">
<field type="plone.registry.field.List">
<default/>
<description xmlns:ns0="http://xml.zope.org/namespaces/i18n" ns0:domain="plone" ns0:translate="">
Enter a list of custom plugins which will be loaded in the editor. Format is pluginname|location, one per line.
</description>
<required>False</required>
<title xmlns:ns0="http://xml.zope.org/namespaces/i18n" ns0:domain="plone" ns0:translate="">Custom plugins</title>
<value_type type="plone.registry.field.TextLine"/>
</field>
<value>
<element>template|+plone+static/components/tinymce-builded/js/tinymce/plugins/template</element>
</value>
</record>
</registry>
我的問題是:如何可以從python代碼或從TAL訪問模板?第一種可能性是從文件系統讀取文件。但是然後安全層將被傳遞。第二個是通過http請求模板。在這種情況下,安全性被考慮在內。但它相當昂貴。有沒有辦法直接訪問模板(plone資源)而不繞過安全性?
通過在我們的論壇community.plone.org發帖,您將有更好的運氣獲得答案,儘管我在論壇上發佈了一個關於您的問題的鏈接 –