Drupal 6 - Views2 - 如何构建非节点视图

发布于 2024-07-22 04:13:37 字数 113 浏览 11 评论 0 原文

我需要在非节点的 drupal 中构建视图,实际上是 drupal 外部的对象。 我调用的 api 向我传回一个 stdClass 对象。

有人知道如何让 Views2 显示非节点对象吗?

I have a need to build views in drupal of non-nodes, actually objects external to drupal. The api that I am calling against passes me back a stdClass object.

Anyone have ideas on how to get Views2 to display non-node objects?

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

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

发布评论

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

评论(5

腹黑女流氓 2024-07-29 04:13:38

我对 Views 2 的理解是,它旨在处理数据库中存储的信息。

如果您无权访问编写 API 所依据的数据库,请考虑将 API 返回的对象写入表中。 最简单的事情可能是从对象创建节点。 然后您可以使用 Views 2 访问它们。

这类似于 Acitivty Stream 模块 (http:// drupal.org/project/activitystream)。 它根据各种 API 返回的数据创建节点。 查看模块的代码,了解如何创建节点的示例:

http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/activitystream/activitystream.module?view=markup

另一方面,如果您有权访问源数据库,您可以考虑直接将该数据库的表公开给视图。 这是 CiviCRM v2.2.3 中包含的最新 Views 2 集成代码中采用的方法,您可以在此处查看:

http://svn.civicrm.org/civicrm/trunk/drupal/modules/views/

CiviCRM 是一个 Drupal 模块,它将数据写入 Drupal 数据库外部的表中——而不是成节点。 视图集成代码将大部分表公开给 Drupal。

希望这可以帮助。

——安德鲁·B.

My understanding of Views 2 is that it is meant to work with information stored in a database.

If you don't have access to the database against which the API was written, then consider writing the objects the API returns into a table. The easiest thing would probably be to create nodes from the objects. Then you could access them with Views 2.

This is similar to the approach taken by the Acitivty Stream module (http://drupal.org/project/activitystream). It creates nodes from the data returned by various APIs. Check out the module's code for examples of how to create the nodes:

http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/activitystream/activitystream.module?view=markup

On the other hand, if you have access to the source database, you might consider exposing the tables of that database to Views directly. This is the approach taken in the latest Views 2 integration code included with CiviCRM v2.2.3, which you can review here:

http://svn.civicrm.org/civicrm/trunk/drupal/modules/views/

CiviCRM is a Drupal module that writes data to tables outside of the Drupal database -- not into nodes. The views integration code exposes most of those tables to Drupal.

Hope this helps.

-- Andrew B.

尐籹人 2024-07-29 04:13:38

根据 Views 3 路线图,Views 最终将处理非 SQL 数据来源。 与此同时,使用 Flikr API 作为概念验证。

According to the Views 3 roadmap, Views will eventually work with non-SQL data sources. In the meantime, some very preliminary work has been done in this area, using the Flikr API as a proof-of-concept.

没企图 2024-07-29 04:13:38

在最新的 6.x-1.x-dev 分支中已修复。 除了节点之外,VBO 现在还支持用户和评论。 特殊的 hook_object_info 可用于支持任何其他类型的对象。 请尝试一下并告诉我!

Fixed in latest 6.x-1.x-dev branch. VBO now supports users and comments in addition to nodes. A special hook_object_info can be used to support any other type of object. Please try it and let me know!

旧情别恋 2024-07-29 04:13:38

Views 专为与节点 + CCK 一起使用而构建。 如果您想为自定义页面创建视图,则需要编写一些额外的模块+主题页面。

Views is built for working with nodes + CCK exclusively. If you want to create views for custom pages, you'll need to code some additional module + theme pages.

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