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




Reader Comments

There are no comments posted for this web log entry.


Post Comment  |  Ask Ben

Recent Blog Comments
Nov 20, 2009 at 11:32 PM
Five Months Without Hungarian Notation And I'm Loving It
I've used headless camel case for years for not only ColdFusion variables, but also SQL tables and fields... pretty much everything involving code. I also subscribe to the "don't abbreviate and clea ... read »
Nov 20, 2009 at 11:00 PM
Five Months Without Hungarian Notation And I'm Loving It
@Marcel, Yeah, I always err on the side of longer but more readable variable names. As for the camel casing of CF methods and the headless camel casing of custom items, I get around this by always ... read »
Nov 20, 2009 at 10:56 PM
Five Months Without Hungarian Notation And I'm Loving It
I use the following and love it: my.namespace.MyComponents.functionMethodsOrUDF() CONSTANT_VALUES_OR_PROPERTIES One thing I always try is to CamelCaseBuiltInColdFusionFunctions() so others can tell ... read »
Nov 20, 2009 at 5:38 PM
Learning ColdFusion 8: CFImage Part I - Reading And Writing Images
Hi Ben, Great article. I've been looking around to see if ColdFusion image engine can programatically create the following "wrap around" effect: http://www.creativepro.com/article/photoshop-s-she ... read »
Nov 20, 2009 at 5:35 PM
Maintaining ColdFusion Sessions Across SMS Text Message Requests Without Cookies
@Dave: I talked to Gert he suggested: <cfhttp method="get" url="http://{some cf website}" result="stuff" addtoken="yes" /> Note the addition of cfhttp attribute addtoken. That should persist y ... read »
Nov 20, 2009 at 5:23 PM
Maintaining ColdFusion Sessions Across SMS Text Message Requests Without Cookies
@Todd, Ahh, gotcha, yeah that makes sense. ... read »
Nov 20, 2009 at 5:17 PM
Maintaining ColdFusion Sessions Across SMS Text Message Requests Without Cookies
Ben, sorry if I didn't make this clear. You can make it work like that if you want, just put <cfset session.foo = 1> (and <cfset application.foo = 1>) in your OnRequestStart() and it reve ... read »