Templated Text Formatters
- Version: 1.11
- Author: Marcin Konicki (http://ahwayakchih.neoni.net)
- Build Date: 19 May 2015
- Requirements: Symphony 2.4.x or greater.
- Text visible on screenshots was rendered with Lobster font (http://www.impallari.com/lobster/) created by Pablo Impallari.
- Check if
/symphony/workspace/text-formattersexists and is writable by Symphony.
- Upload the
templatedtextformattersfolder in this archive to your Symphony
- Enable it by selecting the "Templated Text Formatters" on
System/Extensionspage, choose Enable from the with-selected menu, then click Apply.
- Go to
Blueprints/Templated Text Formattersand create new text formatters.
- 1.11 Updated Markdown template to support latest "Markdown" and "Markdown Typography" extensions.
- 1.10.1 Bugfixes for Symphony 2.4. This drops compatibility with Symphony 2.3.x.
- 1.10 Update for Symphony 2.5.
- 1.9 Update for Symphony 2.3.3. This may break compatibility with Symphony 2.3. Updated Markdown template.
- 1.8 Update for Symphony 2.3. This drops compatibility with Symphony 2.2. Removed Makrell formatter (Makrell project is dead). Fixed a bug in XSLT template (error when there was no utility found).
- 1.7 New template: XSLT.
- 1.6 Update for Symphony 2.2, fixed few bugs, updated Markdown template, added new template: Makrell, changed this README to Markdown syntax.
- 1.5 Update for Symphony 2.0.3. This drops compatibility with Symphony 2.0.2.
- 1.4 A lot of fixes, support translations, updated Markdown template.
- 1.3 Fixes and new template: XSS killer.
- 1.2 Initial release.
You can create new text formatters by selecting template file and then configuring its options. There is special "chain" formatter, that will allow you to chain text formatters, so they will be used one after another to format text. This can be very useful to extend existing formatters to add own markup and/or handle special characters.
Developers of text-formatters can make them "template-friendly".
- Create 'template' subdirectory in your formatter extension directory.
- Create file 'formatter.X.tpl' there. X is the ID of type, try to make it as unique as possible, so no other extensions will clash with it.
- Check 'template/formatter.regex.tpl' and 'template/formatter.chain.tpl' (this one is a bit more complicated) templates to see how to create new templates. In short: look for '/* BIG CAPS STRING HERE */' parts which are "placeholders" for PHP code and/or variables. Look for
ttf_tokens()function which can return placeholder names and data which should be put in those placeholders.
ttf_form()function allows module to add own widgets to text formatter edit page.
- After changing settings of formatter, you have to save every entry with fields that are formatted by it. Otherwise their data will stay unchanged :(. I don't know how (except for some very ugly hacks) to make textareas and other fields using text-formatters to update their content. Maybe formatted text should be cached with some known hash ID (or by text-formatter id)? That way it would be easy to refresh all content when needed (like: clear cache of every text formatted with X).
- I'm not sure about escaping PHP code parts. I tried to make it secure, but... well... backup Your installation before testing this :).