I am looking into creating tooltip popups on words found in the content that match a glossary word. Plan is to create a glossary item (muck like a news item in the Runaway example). Then when the content is rendered to the page match any of the glossary items and highlight the word and put the required HTML to support a jQuery tooltip plugin like qTip or something similar. The tooltip would contain the definition of the glossary item.
Do you think I can accomplish this with an XSLT macro? If so, how could I go about hijacking the "pageContent" element to match the words and update the content on the fly with the tooltips?
Yes, this can be done with xslt, but it is not entirely straight forward.
Your idea about using a 'glossary' document type is right on. You will then create a macro that you'll use in your templates in place of the <umbraco:Item> tag. That macro will look through the field(s) you want to display and search for any matching glossary terms, updating the output as necessary for your tooltip to display.
You will probably find that you will need to search for and render any macros in the field(s) you're displaying. The umbraco.library:RenderMacro() function is your friend there.
You'll also want to keep an eye out for output escaping issues, converting to/from "real" xhtml/xml with the msxml:nodeset() function in your xslt macros. You'll also probably need the Xml2String.xslt file. The is available on the internet and is extremely helpful in these kinds of situations.
Those are the most challenging bits that will come up to bite you, beyond actually handling the logic for finding the glossary terms and inserting the right markup in the output.
Appreciate the helpful information. Just want to make sure I was not heading down the wrong road. I will publish what ever I come up with just incase it helps others!
I saw that and it is pretty close to what I need. It puts in links for keywords and I was looking to do tooltips or something similar. I will ask him for source and try to modify the output to produce javascript. Thanks for the reference.
Dynamic tooltips based on glossary terms
I am looking into creating tooltip popups on words found in the content that match a glossary word. Plan is to create a glossary item (muck like a news item in the Runaway example). Then when the content is rendered to the page match any of the glossary items and highlight the word and put the required HTML to support a jQuery tooltip plugin like qTip or something similar. The tooltip would contain the definition of the glossary item.
Do you think I can accomplish this with an XSLT macro? If so, how could I go about hijacking the "pageContent" element to match the words and update the content on the fly with the tooltips?
Any help would be appreciated.
Yes, this can be done with xslt, but it is not entirely straight forward.
Your idea about using a 'glossary' document type is right on. You will then create a macro that you'll use in your templates in place of the <umbraco:Item> tag. That macro will look through the field(s) you want to display and search for any matching glossary terms, updating the output as necessary for your tooltip to display.
You will probably find that you will need to search for and render any macros in the field(s) you're displaying. The umbraco.library:RenderMacro() function is your friend there.
You'll also want to keep an eye out for output escaping issues, converting to/from "real" xhtml/xml with the msxml:nodeset() function in your xslt macros. You'll also probably need the Xml2String.xslt file. The is available on the internet and is extremely helpful in these kinds of situations.
Those are the most challenging bits that will come up to bite you, beyond actually handling the logic for finding the glossary terms and inserting the right markup in the output.
cheers,
doug.
Doug,
Appreciate the helpful information. Just want to make sure I was not heading down the wrong road. I will publish what ever I come up with just incase it helps others!
Thank you,
Adam
I was just looking for a CMS with this exact functionality. Did you ever finish that feature development?
Hi Darren create package, which create autolinks with very similar functionality,
http://www.darren-ferguson.com/2010/2/4/screencast-auto-link-for-umbraco.aspx
you can try look at it or try ask for sources...
I saw that and it is pretty close to what I need. It puts in links for keywords and I was looking to do tooltips or something similar. I will ask him for source and try to modify the output to produce javascript. Thanks for the reference.
is working on a reply...