Dynamic Counter for Total Number of Website Favorites

Re: [Rusty] Dynamic Counter for Total Number of Website Favorites

By Jason - January 26, 2011

Hi Rusty,

To do this without refreshing the page, you'll need to create your own jQuery function that will call a php script that will calculate your total for you.

This isn't too complicated, but does go a little beyond what we can handle in the forum. If you're interested, please send an email to consulting@interactivetools.com and we can give you some options on how to proceed.

Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] Dynamic Counter for Total Number of Website Favorites

By Rusty - January 27, 2011

After some further digging I was actually able to modify the websiteFavorites.php file to make it reload from an add or remove onclick function.

Blue Code is commented out original. Red Code is the udpated code, Red Bold Code is the code I added.

$onClick = '';
//if ($action == 'add') { $onClick = "wsf_add('$escapedTableOrTag','$escapedRecordNum'); return false;"; }
if ($action == 'add') { $onClick = "wsf_add('$escapedTableOrTag','$escapedRecordNum', true); return false;"; }
elseif ($action == 'addAndReload') { $onClick = "wsf_add('$escapedTableOrTag','$escapedRecordNum', true); return false;"; }
//elseif ($action == 'remove') { $onClick = "wsf_remove('$escapedTableOrTag','$escapedRecordNum'); return false;"; }
elseif ($action == 'remove') { $onClick = "wsf_remove('$escapedTableOrTag','$escapedRecordNum', true); return false;"; }
elseif ($action == 'removeAndReload') { $onClick = "wsf_remove('$escapedTableOrTag','$escapedRecordNum', true); return false;"; }
else { $onClick = "alert('Unknown action specified! Must be add, remove, or removeAndReload!'); return false;"; }


The only thing to remember when modifying the code like this is that it will ALWAYS reload no matter which function, whether add, or addAndReload, / remove, removeAndReload.
Rusty

Re: [Rusty] Dynamic Counter for Total Number of Website Favorites

By Jason - January 27, 2011

Hi Rusty,

Glad to hear that's working for you.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/