Skin Spider : Another Bell And Whistle

Posted November 20, 2006 at 4:16 PM

To learn all about Skin Spider, click here.

To view the most updated application, click here.

To view the current code base, click here.

Just a minor update here. I have updated the videorating.cfm ColdFusion custom tag to have a toggle for whether or not the video clip is a favorite of the user. It works pretty much the same way as the rating (1 to 10) in that it uses a Javascript Image SRC attribute to call the application's API. I have included this as part of the videorating.cfm ColdFusion custom tag because it's sort of a rating and because the tag already existed; however, I could just have easily made a separate custom tag to do just the "favorite" functionality.

If you look at the search.cfm and the favorites.cfm ColdFusion templates, you will see that the only modifications that I have made are that I now get "is_favorite" from the database and use the "isfavorite" attribute of the ColdFusion custom tag. Everything else on those pages remains the same. This is the beauty of the custom tag - it helps protect or minimize the damage that variation can have on the system.

The two major changes of this update were made to the api.cfm ColdFusion template (our system API) and to the videorating.cfm ColdFusion custom tag. If you look at api.cfm, you will see that I have added another CFCase statement for the action "set_favorite". Like the "rate_video" action, "set_favorite" also takes the ID of the video in question. It also takes a boolean indicating whether or not the video is a favorite. It then takes this information and updates the database.

If you look at the videorating.cfm ColdFusion custom tag, you will see that I just added another link that says "Favorite." This link calls the Javascript method SetVideoFavorite(). This Javascript method is defined in the custom.js file. Like I said before, this method just uses the SRC attribute of a Javascript image to ping the system's API (api.cfm). In addition to pinging the API, this method also changes the CSS class of the Favorite link. If you try out the page, you will see that this CSS class defines the format and the gold star (background-image) of the link. Not very complicated stuff here. I have decided to make the gold start part of the CSS class, rather than an inline image because this way does not require the ColdFusion custom tag to know anything about the paths to the images folder. Right now, all the ColdFusion custom tag has to know about is what attributes it gets and what Javascript methods are available. I am trying to keep the coupling as low as possible.

So now, there is an inline way to rate the video clips and flag them as favorites. I have been trying to take care of these "low hanging" fruits - the easy changes - before I move on to the final, more complicated changes of Iteration 2. Hopefully over the holidays, I will have time to start thinking about the referential navigation, the biggest of the remaining Iteration 2 changes.

Post Comment  |  Ask Ben  |  Permalink  |  Other Searches  |  Print Page



Learning ColdFusion 9 - ColdFusion 9 tutorials, samples, examples, demos

Reader Comments

There are no comments posted for this web log entry.


Post Comment  |  Ask Ben

Recent Blog Comments
Nov 21, 2009 at 6:47 PM
Hal Helms - Real World Object Oriented Development, Sarasota - Day Five
@charlie griefer, Thank you.. ... read »
Nov 21, 2009 at 5:15 PM
Using ColdFusion Structures To Remove Duplicate List Values
@Jose Galdamez, Oh heh yeah I didn't paste the whole code. I should have defined the vars -- my bad. It's fixed thou. Thanks. ... read »
Nov 21, 2009 at 4:49 PM
Styling The ColdFusion 8 WriteToBrowser CFImage Output
Great work yet again Ben! Whilst I didn't use this whole code, I copied some of your regex code for a similar problem with the lack of an alt attribute and unescaped ampersands in CFIMAGE for Railo 3 ... read »
Nov 21, 2009 at 1:13 PM
My First ColdFusion Builder Extension - Encrypting And Decrypting CFM / CFC Files
@Ben, Because I am pedantic, I just want to make sure that everyone knows there is absolutely no encryption going on. There is only encoding and obfuscation. The cfencode tool only obfuscates your C ... read »
Nov 21, 2009 at 12:28 PM
Using ColdFusion Structures To Remove Duplicate List Values
@Jody I can't seem to get your code sample to work. If you are still having problems, try this code out and see if it gets you what you wanted. <!--- Comma delimited list with various duplicates ... read »
Nov 21, 2009 at 11:03 AM
Groovy Operator Overloading Does Not Work In The ColdFusion Context
Hi Ben, Thanks for this informative post. Now I am reading ur old posts too ... read »
Nov 21, 2009 at 10:56 AM
HostMySite.com Has The Best ColdFusion Hosting
@Mehul, Yes very nice people, however several downtimes per day which was not acceptable. Hence we had to move out. I am glad you are having good luck with them so far. ... read »