Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Adam Attard 5 posts 25 karma points
    Dec 01, 2009 @ 20:23
    Adam Attard
    0

    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.

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Dec 01, 2009 @ 22:27
    Douglas Robar
    0

    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.

  • Adam Attard 5 posts 25 karma points
    Dec 01, 2009 @ 22:41
    Adam Attard
    0

    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

  • Keith Carlson 2 posts 22 karma points
    Apr 16, 2010 @ 07:39
    Keith Carlson
    0

    I was just looking for a CMS with this exact functionality.  Did you ever finish that feature development?

  • Petr Snobelt 923 posts 1535 karma points
    Apr 16, 2010 @ 09:29
    Petr Snobelt
    0

    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...

  • Keith Carlson 2 posts 22 karma points
    Apr 16, 2010 @ 17:20
    Keith Carlson
    0

    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. 

Please Sign in or register to post replies

Write your reply to:

Draft