Hi Guys,

I've been tasked on creating a glossary section (no big deal keywords + descriptions) however the client would like to have the same keywords being highlighted in text/content areas filled in other particular Sections.

For example if I write keyword on mouse-over a pop-up should appear saying this keyword is important in this context and I will explain what it means. This is to be done in the backend on save, and preferably whatever I inject into the section will not make it harder for the user to change/edit the text.

I currently see two/three alternatives.

  1. Add the glossary data-source on everypage and do some sort of parse (very in-efficient)
  2. Add a post/pre edit event and inject html preferably into the formatted version of the textbox on every load
  3. Add a pre edit - identify keywords and att these keywords in a subsection (which is hidden from user view) (still would need front-end computation on every page load to find the keyword in content)
  4. Mix of 3/4 by including a (tag) where the popup should appear in the html then replaced using a ninja technique

I would really appreciate some feedback on this - maybe I could package something that works for similar situations.

A similar question was asked just a couple of days ago. I think he finally implemented something like your 1.. You can always cache the glossary DS if it's too big. I'd try matching the glossary and text data in the XSL at runtime at first and see how expensive it is.

Ah yes forgot that thread had read through it around a week ago.

  1. was my first idea however I am estimating over hundred of pages of content. First Module of the collection (out of 6) I just inserted for a test case and it's already got around 40 sub-sub chapters (around a page each). If each of those had a keyword or two minimum - I could be running into an XML data-source with hundreds of entries with a replace running on each entry (which doesn't sound very cool to me..)

Possibly selecting the keywords via a subsection manager / select-box link in the background can help filter the number of entries making the process more efficient.

Caching would be done in any case - as it is most likely to be a relatively big website.

Have you considered to use the Templated Text Formatters extension? Haven't tried it before, but I guess you should be able to build a custom text formatter that grabs your glossary and adds the appropriate markup. Because it's only done on creating or editing entries it would be ok to grab the whole glossary during the formatting. So there would be no need to add the keywords in a subsection manager for that entry. The one downside is that you have to resave all the entries when the glossary changes. But there is the Resave entries extension for that job.

Or (thinking out loud) you could use the Reflection Field. There is a branch that works with Symphony 2.3 and that is able to use a XSL utility to transform the value. Though you'd have to get the glossary into the mix somehow.

Thanks for the great input. I was considering trying to add a text-formatter to be honest or hacking in somewhere in between the markdown process. So the link to the extension is great to start with so I could run the markdown then my custom one.

Hmm the resave entries thing every time there is an update is not so cool, I will probably use the formatter to output my keyword and then just retrieve all the keyword ids via (a subsection or something else) to be replaced live in XSLT. not sure which way to go. but thanks for the great input Jonas.

Thanks again for the Good Lead I've managed to edit my output via Templated Text Formatters however I couldn't put in the text description straight away as I'm working in multilingual mode and keywords might overlap between languages.

I wonder weather it would be best to create a new field-type to output the list or else use a hidden select-box link. I prefer a new field-type as this I would want to keep hidden and possibly fill up / update after the text-formatter runs but I am not sure if this is possible.

Again, thinking out lout: can you add a delegate in the custom text formatter and subscribe to this delegate in your custom field? In the delegate you can pass the found glossary items and fill the content of the custom field.

Hmm very good idea. For now temporary solution I've used a select-box link - saving some stuff temporarily in the Symphony-Config (will probably replace this with something else) and then using the EventPostCreate/Edit to override the entries saved into the select-box link. Seems to work so far.

Going to test it properly before packaging anything but seems to be quite sweet.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details