WynApse Home Page
Home    Blog    About    Contact       
Latest Article:


My Tags:
My Sponsors:






Lifetime Member:

Tag Cloud Added to My Site using the VRK Control from Code Project


After I finished my Blog Roll and started using it, I realized I wanted a way to capture links for some of these pages. I can print to PDF using my favorite PDF-producer, but I might not want to do that for everything, and it doesn't make the content globally available.

I realized I'd like to have a Tag Cloud on the Blog Roll and be able to tag other people's articles in the same manner folks at some of the major blog sites tag theirs, and then be able to retrieve the articles by tag from the cloud.

I looked around the web and found a couple articles. Scott Mitchell at 4 Guys From Rolla has an article about one that you can roll your own that was very easy to read, and made sense. I also found a nice one at The Code Project that I liked a lot since it rolled out a control that you could drop onto a page. I realized if I was going to do this, I'd probably want to add it to my articles as well, so I chose to go with The Code Project VRK Control by Rama Krishna Vavilala, to be able to just place it twice. I also thought it was very cool that the VRK Control uses Standard Deviation calcluations to determine font sizes.

I built the control and sample to make sure it all worked for me, then spent some time figuring out how I wanted to lay out my database tables for two sets of interconnected tagged links.

I probably spent more time on my Admin page working on the setup and populating of the tables than I spent on actually getting the Cloud onto the screen. My Admin page has a section that looks like this:



Entering a New tag will clear the tag textboxes but not the Cloud entry boxes, so if I find myself wanting another tag while I'm entering, I can just enter it. The tag CheckboxList refreshes to show the new entry, and it's good to go. The Label is pasted in, and the Link can be dragged from the browser. the Local checkbox is set if it is one of my own articles local to my site.

My "Cloud Table" is recalculated when I enter a new article, and contains a Local flag.

When either the MasterPage or BlogRoll is opened, the appropriate Cloud control is populated as shown here:

        SqlDataReader drCloud = LocSupt.getCloudData(1);
        this.MyCloud.DataSource = drCloud;
        this.MyCloud.DataTextField = "cloudText";
        this.MyCloud.DataHrefField = "cloudUrl";
        this.MyCloud.DataTitleField = "cloudToolTip";
        this.MyCloud.DataWeightField = "cloudWeight";
        this.MyCloud.DataBind();

getCloudData() takes one parameter and that is the Local flag used in determining which set of data to display. A SqlDataReader is then returned containing the appropriate data for the VRK Cloud control.

The only remaining work is to notifiy the control how to map the data fields retrieved and bind the control.

When I refresh my Cloud Table, I only populate it with tags that are used in the context I'm desiring, so for instance, on my site I have articles about Virus attacks, but have none on SQL, so my query keeps the two separate, clean, and relevant.

I could have used a single Content page for both displays but would have needed two QueryString entries, and while not difficult, would be ugly, so I chose to just put up a separate page for the Local ones.

All in all, this was a very simple piece of work given the VRK Control and I'd recommend it. Following are two screenshots, the smaller being my Local Cloud and the larger the Cloud of "Other People's Articles" from my Blog Roll page:

  

Copyright © 2006-2017, WynApse