Shaun Mccran

My digital playground

18
O
C
T
2009

Converting Word Press Cumulus plugin to BlogCFC

The other day I saw the Word Press Blog Cumulus plugin (http://wordpress.org/extend/plugins/wp-cumulus/) on a fellow bloggers site, and thought 'I like that, I wonder if it will work inside the Blog CFC framework'. I thought I'd convert it so that it would.

The Cumulus plugin uses the regular Blog category cloud and turns it into a three dimensional rotating globe. It does this using a flash object, and a series of parameters passed in as flashvars.

view plain print about
1<s/cript type="text/javascript" src="#application.rootURL#/includes/swfobject.js"></script>
2    <div id="flashcontent">This will be shown to users with no Flash or Javascript.</div>
3
4    <s/cript type="text/javascript">
5        var so = new SWFObject("#application.rootURL#/includes/tagcloud.swf", "tagcloud", "170", "120", "7", "##ffffff");
6        // uncomment next line to enable transparency
7        //so.addParam("wmode", "transparent");
8        so.addVariable("tcolor", "0x3258B8");
9        so.addVariable("mode", "tags");
10        so.addVariable("distr", "true");
11        so.addVariable("tspeed", "100");
12        so.addVariable("tagcloud", "#variables.tagsList#");
13        so.write("flashcontent");
14    </s/cript>

You need to include the 'swobjects.js' reference call to process to swf, otherwise the 'flashcontent' div will be displayed.

The flashvars include the variable 'tagcloud', this controls which tags are displayed, what their colors are, and where the go (URL). These are generated in a cfsavecontent variable almost as a list.

view plain print about
1<cfsavecontent variable="variables.tagsList"><tags><cfloop query="tags">
2                <cfif tags.tagCount EQ min>
3                    <cfset size="9">
4                <cfelseif tags.tagCount EQ max>
5                    <cfset size="20">
6                <cfelseif tags.tagCount GT (min + (distribution*2))>
7                    <cfset size="16">
8                <cfelseif tags.tagCount GT (min + distribution)>
9                    <cfset size="13">
10                <cfelse>
11                    <cfset size="11">
12                </cfif><a href='#application.rootURL#/index.cfm?mode=cat%26catid=#tags.categoryid#' style='#size#' <cfif len(variables.color)> color='0x#variables.color#' </cfif> <cfif len(variables.hicolor)> hicolor='0x#variables.hicolor#' </cfif> >#lcase(tags.tag)#</a></cfloop></tags></cfsavecontent>

The swf will control the color of the Tags based on their sizing, or you can specify a 'color' and a 'hicolor', which are the regular color and the highlight color respectively. I have placed the swfobject.js and the tagcloud.swf in my site/includes/ directory, but you can put it where you want, just edit the links.

You can download the code from RIA forge here: Link

Thanks to Roy Tanck for the documentation on how the Cumulus plugin works:

http://www.roytanck.com/2008/05/19/how-to-repurpose-my-tag-cloud-flash-movie/

TweetBacks
Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
Kemsar Rooch's Gravatar The sites like https://theyounghopeful.wordpress.com/2015/09/14/h... are wonderful and interesting. It is very current and latest norm and art of the statistics and mathematics. It is provided and ensured.
# Posted By Kemsar Rooch | 16/12/2015 03:28
Back to top