Drupal 视图集成
这与 Drupal 6 和 Views 2 有关。
我对 Drupal 并不陌生,但我对使用 Views 时出现问题感到陌生。
我在模块中定义了一个自定义视图,该视图与这样的数据集成(我认为):
$view->base_table = 'tblName';
我正在集成第三方 API。它返回给我一个漂亮的普通 PHP 对象。
我需要一种方法,让该 API 的列表返回成为动态视图的 base_table。这可能吗?我想到的丑陋的解决方案是将每个返回项设为一个节点,然后将它们用作“base_table”。我认为这可行,但看起来很丑。我不希望有一堆节点闲逛以供稍后使用。
有什么建议吗?谢谢。
This relates to Drupal 6 and Views 2.
I'm not new to Drupal, but I am new to problematically using Views.
I have a custom view defined in a module which is integrated with data like this (I think):
$view->base_table = 'tblName';
I am integrating a third-party API. It returns me a pretty vanilla PHP object.
I need a way for list returns from that API to become the base_table for the view, on the fly. Is this possible? The ugly solution I was think of was making every return item a node, and then using those as the "base_table". I think that would work, but it seems ugly. I don't want a bunch of nodes hanging around for later.
Any suggestions? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定这是一个好主意,但我最终创建了一个基于 Drupal 缓存机制的例程。我正在动态删除并创建一个表,并将该表交给 Views。 API 每五分钟填充一次该表。可以通过清除 Drupal 缓存来强制重新填充它。
我尝试使用 MySQL 临时表,但它们的持久性不够好。我想知道是否有一种方法可以使它们的连接更加持久,或者持续一定的时间。
I'm not sure this is a good idea, but I ended up creating a routine based around Drupal's caching mechanism. I'm droping and creating a table on the fly and handing that table to Views. The table is populated every five minutes by the API. It can be forcibly re-populated by clearing the Drupal cache.
I tried using MySQL Temporary tables, but they didn't persist well enough. I wonder if there is a way to make them more connection-persistent, or to last a certain amount of time.