I have an established open-source software project, and I've been fortunate enough to get donations from users. My website uses Drupal (6.19) and I'd like to add a block that shows a list of recent donations, e.g.:
Thank you for supporting OpenSTV
John Smith $5 12/20/2010 Mary Kay $20 12/5/2010 Ingwe Malmstein $50 11/27/2010I've never done any custom work in Drupal, but my idea to do this was to:
- Create a custom content type called Donation that has only a title (did this already)
- Create a new Donation entry for each donation (did this too)
- Create a block that shows the 5 most recent donations
- Have the block appear in the sidebar (know how to do this)
I don't know how to write the php code for 3. Is there a simple example of doing something like this that I could copy from? Or is there entirely different way of doing this that would work better?
I've 开发者_C百科never written any php code so the simpler the better. Any help would be greatly appreciated.
Use the Views module. Here is a quote about it (from its project page):
You need Views if:
- You like the default front page view, but you find you want to sort it differently.
- You like the default taxonomy/term view, but you find you want to sort it differently; for example, alphabetically.
- You use /tracker, but you want to restrict it to posts of a certain type.
- You like the idea of the 'article' module, but it doesn't display articles the way you like.
- You want a way to display a block with the 5 most recent posts of some particular type.
- You want to provide 'unread forum posts'.
- You want a monthly archive similar to the typical Movable Type/Wordpress archives that displays a link to the in the form of "Month, YYYY (X)" where X is the number of posts that month, and displays them in a block. The links lead to a simple list of posts for that month.
精彩评论