May 8th, 2010, 10:33 AM
Hey Vizzaroo,
Sure, no problem! Try something like this:
My math is pretty awful, but that should work. We use floor() rather than round() because the only ever time you want to see 100% is when the number of results in $count2 is identical to $count1. round() would round it up if it was .5 or higher.
- Ben
Sure, no problem! Try something like this:
PHP Code:
$count1 = ft_api_show_submission_count(1, 235);
$count2 = ft_api_show_submission_count(1, 236);
// now $count1 and $count2 contain the number of results in those
// two Views. Assuming $count1 will always contain more than $count2:
$percentage = floor(($count2 / $count1) * 100);
// display it!
echo $percentage;
My math is pretty awful, but that should work. We use floor() rather than round() because the only ever time you want to see 100% is when the number of results in $count2 is identical to $count1. round() would round it up if it was .5 or higher.
- Ben