Adds dynamically-updated rich text snippets to Plone. Update a snippet to display the change everywhere the snippet is used (pages, news items, events, anywhere rich text and TinyMCE appear).
Version 2.x is compatible with Plone 5.0+
Earlier versions are compatible with Plone 4
The uwosh.snippets package allows you to include dynamically updated rich text snippets (chunks of rich text) anywhere in your site that uses the TinyMCE editor (i.e., any rich text field), including Pages, News Items, and Events.
Snippets can be used anywhere that rich text can be used. They are inserted into a page much like you would an image or hyperlink.
Because snippets are dynamically rendered, if you edit the snippet, its updated rich text is shown everywhere you had inserted the snippet.
This is much more efficient and less error prone than copying and pasting rich text in multiple places in your site.
A university wants to display its number of enrolled students consistently across its web site. Instead of manually updating each page that mentions the number of enrolled students and having to remember to change each of these pages whenever the enrollment number changes (e.g. annually), a content editor would create a snippet called "Enrollment Number" containing the rich text "13,491 students" and would insert that snippet wherever the enrollment number needed to be displayed.
Whenever the official enrollment number changes, the content editor edits the "Enrollment Number" snippet to update the count, e.g. "14,120 students", and saves the change. All subsequent views of pages that contained that snippet will display the updated number.
A new folder called "Snippets" (with ID ".snippets") will be created at the root of your site; that is the default location where the add-on will look for snippets.
To add a snippet:
You have created your first snippet! You can use this snippet in one or more places on your site, anywhere TinyMCE is used as the editor.
To insert a snippet:
Instead of seeing the snippet plug you will now see the rich text contents of the snippet.
uwosh.snippets includes a control panel, available at Site Setup -> Snippets ('@@snippets-controlpanel').
Related items settings:
.snippets
and title Snippets
). For
example, to look for snippets in a folder with the ID blabla
at
the root of your site, change the value of basePath
from /.snippets
to /blabla
.selectableTypes
from [Document]
to [News Item]
.Code display expression:
string:Snippet:[ID=${context/@@uuid}]
. This is probably not a
setting you will want to change.Render expression:
context/text/output|context/getText|nothing
. This is probably not
a setting you will want to change. See the TAL expression documentation <https://docs.plone.org/develop/plone/functionality/expressions.html>
_.If you want a snippet to be rendered without causing a line break
(because of the p
tag that TinyMCE wraps around the rich text), edit
the snippet and, beneath the TinyMCE rich text editing area, use the
Text drop down and choose text/x-web-textile
. Then manually remove
the p
tag around the snippet's rich text and click Save. The rich
text will be saved without TinyMCE re-wrapping it with the p
tag,
and when you use the snippet elsewhere it will not start a new
paragraph.
The TinyMCE WYSIWYG editor needs to be installed and enabled. A basic
understanding of its use is also highly recommended. For more
information about TinyMCE, visit their website <http://www.tinymce.com>
_.
The original concept was developed by Sam Schwartz for the Office of International Education at University of Wisconsin Oshkosh.
Plone 5 compatibility was developed by Nathan Van Gheem / Wildcard Corp. for Philip Bauer / Starzel.de.
This add-on is maintained by Wildcard Corp., https://wildcardcorp.com, developers of the Castle CMS enhanced distribution of Plone, https://castlecms.io