Jump to content

donation meter


cssfreakie

Recommended Posts

Hi all,

 

I sometimes see on a website, a little meter that says, we raised 1 million and our goal is 1 billion (or anything lower than that ::)

i was wondering on how someone would achieve that (besides the probably GD library), is that done real time? or does someone need to adjust it on a daily bases depending on the donations. If it is done real time, may I assume that it would be pretty risky to connect to the account to fetch results right?

Hmm if anyone knows an idea i would love to know. I never worked with pay-pal, and i am playing around  with it in case i might need to work with it.

Link to comment
Share on other sites

A couple of ways it could be done:

  • Like you said, manual updating... although tedious
  • When a donation is made it adds to a running total in a database, flat file, etc.
  • When a donation is made, a full new row is made in the database - from there you can see more stats (who made the largest donation, average donation amount, etc)

 

Also, you can do this via CSS with a little bit of trickery instead of doing GD ;)

Link to comment
Share on other sites

Thanks Philip!

 

May I assume the script that is updating that would be run on a external (non paypal) redirect script or something after the payment was successful?

 

that css thing would require some javascript i bet or some inline style imported from a database, to set the width or height of an element.

Thanks for the input!

Link to comment
Share on other sites

After the payment was successful. For example, with Paypal you should use IPN to grab the payment info (or parse via email, etc.)

 

No JS required, the CSS would either have an inline styling with lets say width % or a class that is set for width %. Example for being 55% to your goal:

<div id="donation_bar"><div class="progress" style="width:55%;"> </div></div>

<div id="donation_bar"><div class="progress 55"> </div></div>

 

Of course this is a very basic example, but you catch my drift ;)

Link to comment
Share on other sites

May I assume the script that is updating that would be run on a external (non paypal) redirect script or something after the payment was successful?

 

this is done at check out though paypal's IPN, they'll notify you at a dedicated page to let you know a purchase has occured, how much, by who, etc.

https://www.paypal.com/ipn

 

 

Though people will tell you its relatively simple process, you need to have a strong php/mysql experience to really get it going.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.