Site Donations


Another way many websites generate revenue is through donations. Gifted funds are becoming increasingly popular as the growth of open source promotes the altruistic giving away of people's work. Many online projects survive solely through the donations of their users.

PayPal (www.paypal.com) is by far the method of choice for sites wanting to accept donations. The service has a variety of built-in tools that really do all the work for you. The following block options were all initially written to work with PayPal, but in most of the blocks, you can alternatively enter in the code for other companies, such as Amazon.com (www.amazon.com) or Kagi (www.kagi.com).

pncPayPal Contribute

The pncPayPal Contribute block from pnConcept (dev.pnconcept.com) is the fastest and easiest way to make a PayPal donations block. The block can be downloaded from the pnConcept link given previously, and it is available as part of this book's online materials.

The archive has three PHP files in it, all of which need to be copied into your site's includes directory. The complete paths are contained in the zip, or you can simply decompress the file in your site's folder. Because the block does not have an accompanying parent module, the install places the block with the other core blocks.

Browse to your Blocks Administration page. Add a new side block with the type Core\PayPal Contribute Block. The Title field can contain any message you want, "Support the Site" for example. pncPayPal also gives you the ability to select your donations' currency type (see Figure 13.5).

Figure 13.5. Selecting your donations' currency type.


To complete the block, you only need your PayPal account email. All of the PayPal system source code is already built in to the block. When you are done, you'll have a block similar to the one in Figure 13.6. The text in the example is in the module by default, but you do have control over that aspect as well. Open the following file in your editor, and make the appropriate changes to the text definitions:

Figure 13.6. Instant PayPal donations block.


 /includes/language/blocks/eng/pncpaypalcontribute.php 

Donations Block

The Donations Block by pnFlashGames (pnflashgames.com) requires a bit more effort than pncPayPal Contribute, but it has the additional feature of a Top Donators listing. The examples in this overview were accomplished with version 1.0 of the Donations block, which is available for download at the pnFlashGames site, under Downloads, PostNuke Modules, Other Addons, and you can download it from the online book materials.

The one PHP file that comes with the block needs to be copied to your site's main blocks folder with this path:

 /includes/blocks/donations.php 

Next go to your site's Block Administration table and add a new block of type Core/Donations. The options are somewhat similar to pncPayPal Contribute (see Figure 13.7). Complete the Title field as before, perhaps with text like "Support the Site." The Show the Donation Amount Next to the Name? check box toggles the display of the amounts entered later in the form (see Figure 13.8). You can also enter an identifying character for the currency type in the next field.

Figure 13.7. Adding a custom donations button to your block.


Figure 13.8. Honoring your top donators.


The Donations block also provides subtitle capabilities similar to pncPayPal Contribute, but instead of editing the language file, you only need to type in the text you want displayed in the Subtitle Text field. The subtitle appears below the title in italic.

The Donation Button Code text area allows you to paste whatever custom code you want, from any online service, such as Amazon.com, PayPal, or Kagi. The example code in Figure 13.8 is from the PayPal Donations block. The flexibility of using different code also lets you customize the image(s) you use.

Tip

Add buttons from multiple services to give your site users the option of choosing their preferred method of donation.


The final line of fields in the block lets you manage a listing of Top Donators (see Figure 13.8). Each name is displayed by the donation amount. When entering amounts, only use the number, such as "25," without a dollar sign or other monetary marking.

The listing is managed manually, so as you get additional donations, you need to adjust the list accordingly.

HTML Block

PostNuke also includes a simple Hypertext Markup Language (HTML) block you can create by selecting Core/HTML from the list. The block has only two content fields for a title and your button code. This method can accomplish a display and functionality identical to either of the other blocks, but it requires that you write the XHTML to make it work.



    PostNuke Content Management
    PostNuke Content Management
    ISBN: 0672326868
    EAN: 2147483647
    Year: 2003
    Pages: 207
    Authors: Kevin Hatch

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net