添加块以显示最近的捐赠列表

发布于 2024-10-09 23:26:55 字数 571 浏览 0 评论 0原文

我有一个成熟的开源软件项目,并且我很幸运能够得到用户的捐赠。我的网站使用 Drupal (6.19),我想添加一个显示最近捐赠列表的块,例如:

感谢您支持 OpenSTV
约翰·史密斯 $5 12/20/2010
玫琳凯 $20 12/5/2010
Ingwe Malmstein $50 11/27/2010

我从未在 Drupal 中做过任何自定义工作,但我的想法是:

  1. 创建一个名为 Donation 的自定义内容类型,它只有一个标题(已经这样做了)
  2. 创建一个新的 Donation 条目对于每笔捐款(也这样做了)
  3. 创建一个显示最近 5 笔捐款的块
  4. 让该块出现在侧边栏中(知道如何执行此操作)

我不知道如何编写 3 的 php 代码。有没有一个简单的我可以复制类似的事情的例子?或者是否有完全不同的方法可以更好地做到这一点?

我从来没有写过任何 php 代码,所以越简单越好。任何帮助将不胜感激。

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/2010

I've never done any custom work in Drupal, but my idea to do this was to:

  1. Create a custom content type called Donation that has only a title (did this already)
  2. Create a new Donation entry for each donation (did this too)
  3. Create a block that shows the 5 most recent donations
  4. 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 never written any php code so the simpler the better. Any help would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

三寸金莲 2024-10-16 23:26:55

使用视图模块。以下是关于它的引用(来自其项目页面):

如果出现以下情况,您需要视图:

  • 您喜欢默认的首页视图,但您发现想要对其进行不同的排序。
  • 您喜欢默认的分类/术语视图,但您发现想要对其进行不同的排序;例如,按字母顺序排列。
  • 您使用 /tracker,但希望将其限制为特定类型的帖子。
  • 您喜欢“文章”模块的想法,但它不会按照您喜欢的方式显示文章。
  • 您想要一种方法来显示包含某种特定类型的最新 5 篇帖子的块。
  • 您想要提供“未读的论坛帖子”。
  • 您想要一个类似于典型 Movable Type/Wordpress 存档的每月存档,该存档以“月,YYYY (X)”的形式显示链接,其中 X 是该月的帖子数,并以堵塞。这些链接指向该月的帖子的简单列表。

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.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文