Flash Tag Clouds in SharePoint
So I was at work last week when one of my colleagues came over and asked about the ability to make a dynamic tag cloud in SharePoint. We had collected a bunch of ideas from the workforce and they wanted an intuitive way to display them all in a dynamic fashion. My first thoughts were of the cumulus WordPress plugin that I use here on my blog, and after turning to trusty Google I discovered that I wasn’t the only one who had this idea. We based our work off of this blog post, with of course a few tweaks of our own.
This of course emphasizes my points of the usefulness of and my discovery of jQuery as it uses some simple jQuery to access the SharePoint list data. We made our integration a bit cleaner by utilizing the jQuery Library for SharePoint Web Services. We also used jQuery to fade the screen and display the tag cloud in a “floating” popup over the page content so we could keep it nice and big, positioned on top of the SharePoint page.










i have tried to use this in sharepoint, but never got it to work. My dream would be to get this tagcloud to work with the Kwiz tag lists. The kwiz tag list allows users of the site to add their own tags, so the list grows. It also has the normal tag cloud functionality, where in the number of times the tag is used, determines its size in the cloud. could this tagcloud be manipulated to accomidate the changing nature of the kwiz tag cloud as well as the popularity of the tag?
Charles,
The Cumulus tag cloud is simply fed by XML so assuming you can get access to the Kwiz list data I don’t see why not. I’m not really familiar with Kwiz or where the data is actually stored so I’m not positive how you’d get to it. The Cumulus flash file does the work for you in determining the size of the links you just need to give it a link node inside for each time a tag is used. In essence, a choice field with the option for users to add tags that aren’t there can meet your needs without even using Kwiz.
I’ve been looking at getting this to work for our system.
Any chance of getting the code you used to display a Tag Cloud via a CEWP for SP2007?
Brett,
Sorry for the delayed reply, I’ve been in the process of moving. The code can/will be the same as you move from WSS3 to SP2007, and even SP2010. What the tag cloud looks for is an XML source, so all you need to do is create a HTML file that writes XML for the cloud to look at.
I used Marc Anderson’s SPServices jQuery library to make the web service call, basically just call the GetListItems operation of the Lists web service, and parse out whatever column you want to display in the tag cloud.
Mike
Hi, your tag cloud is fantastic!
I have tried to get wp-cumulus to work with sharepoint 2007 many times – with absolutely no success. I would really like to know how to get the tag cloud to work through the CEWP as I have no access to upload a separate webpart.
Any chance of sharing your knowledge?
Carol,
When I did this in 2007, it was through a CEWP. You can use SPServices to query the list/fields and build the XML markup that wp-cumulus consumes. You’d need to add jQuery and SPServices to a library, load them in your HTML/TXT file, then include the SPServices CAML query and JavaScript. You’d then want to point your CEWP to use that HTML/TXT file as its source.
Thanks Michael.
I have tried using JQuery and Flash (based on this article: http://zabistop.blogspot.com.au/2009/08/flash-tag-cloud-in-sharepoint-using.html) but its as dead as a door-knob.
Would you have an example of the code you used?
I am on a steep learning curve!
Carol,
Unfortunately it has been years (and a couple jobs ago) since I did it. You should be able to use that blog post verbatim, just changing the red text in the script to reflect the correct site URL, List Name, and fields (columns). This all assumes that you’ve got a list of all your tags, vs trying to actually pull categories from a SharePoint blog or something (which would be a little more complicated–though certainly possible).
The XML that’s built in the script (soapEnv) is the XML for the SOAP (web service) request. You’re essentially defining what you want the SharePoint web service to return to you. You need a FieldRef element in the ViewFields node, for every column in the list that you want to return, so this example assumes you have columns called “Tag”, “Link”, and “Style”. To make it simple, you could remove the “Style” field ref, and the related (style=’” + $(this).attr(“ows_Style”) + “) markup in the script.
You don’t need to touch the $.ajax lines of the script, this is the jQuery piece that sends off the SOAP request to the SharePoint web service (lists.asmx). The processResults function then takes the XML that the web service returns and parses it, building a string (“tags”) of the link for each row returned. Note that when you request fields in the SOAP XML you’re using “Link”, and when you work with the returned information you’re using “ows_Link” SharePoint’s Office Web Services will prefix an “ows_” on the front of your column names when the data is returned.
From there you’re wrapping the whole thing in a “tags” node, so your final script-generated XML should look something like this:
My advice would be to focus on getting that data to return correctly, before you add in the Flash component. If it’s blowing up, it’s probably more likely to be a result of the data being returned badly, as opposed to an issue with wp-cumulus. You could add an alert(tagDetails); to your script so the browser throws an alert box with the XML in it (for debug purposes).
Once you can validate that the data is correct, you can add in the SWFObject piece which loads the wp-cumulus and pushes the XML (tagDetails) variable to it for rendering.
I also originally had problems with the code offered on the linked blog at the top of this page. It simply displayed ‘This will be shown to users with no Flash or Javascript.’ message and I left it for a while. I recently returned to it and realised that copying the code straight from the blog page into a CEWP had included a number of carriage returns, or similar, and the code was all over the place. A quick tidy to remove the blank line and it all sprang into action.
Regards,
David
David,
If you get the “This will be shown to users with no Flash or Javascript”, then the script is either failing over to HTML because the user doesn’t have Flash (or the correct version) installed, or [as you discovered] there’s poor formatting in the markup.
Regardless of if you’re using 2007 or 2010 (but more so with 2010), it’s not a great practice to put that markup directly in the CEWP. If you’re dynamically building markup, as is the case here with the XML that drives the cloud, storing it in the CEWP directly will often result in physically saving the dynamically written markup when you save the page (making it static). As a best practice, any sort of script files should be stored in a library, with the CEWP pointed to the script file in the library.
Hi Michael, Thank you for your tips – I am much closer to getting it to work.
I have debugging and alerts running and it ‘looks’ like its all working as it should (tags being returned as expected and the box is there in the right color and the right size etc.)
But nothing is being rendered in the cloud!
David , thank you for your tip also – I think ‘cleaning up’ the code has got me this far.
I am learning as I go (but its very frustrating!)