Sharing has commenced. These functions are used for writing values to a flat file from the jQuery Star Rating Widget.
// ======================== // Functions // ======================== function in_range($val, $from=0, $to=100) { return min($to, max($from, (int)$val)); } function get_dbfile() { return preg_replace('#\.php$#', '.dat', __FILE__); } function get_votes() { $dbfile = get_dbfile(); return is_file($dbfile) ? unserialize(file_get_contents($dbfile)) : array('votes' => 0, 'sum' => 0, 'avg' => 0); } function save_vote($vote) { $db = get_votes(); $db['votes']++; $db['sum'] += $vote; $db['avg'] = sprintf('%01.2f', $db['sum'] / $db['votes']); file_put_contents(get_dbfile(), serialize($db)); return $db; } -----Original Message----- From: Paul Alkema [mailto:paulalkemadesi...@gmail.com] Sent: Thursday, June 25, 2009 4:37 PM To: cf-talk Subject: RE: PHP to CF pseudo code... You could always share and see if someone feels like translating it for you. :) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:323953 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4