如何使用 Drupal 报告在 Drupal 之外处理的数据表?
是否有一个模块或一组模块可以用于此目的。我在 Drupal 之外使用 sql 脚本等处理数据。我读到,视图和 CCK 的组合可以工作,但它涉及再次设置每个字段(在 CCK 内)。我尝试过在块内使用 php 代码,但显示选项有限。我必须创建一个新模块吗?
Is there a module or set of modules that can be used for this purpose. I process the data using sql scripts etc outside of Drupal. I've read that the combination of Views and CCK could work, but that it involves setting up every single field again (within CCK). I have experimented with using php code within blocks, but the display options are limited. Will I have to create a new module?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为此使用 CCK 是一个非常糟糕的主意。
您的外部脚本需要考虑所有这些。唯一正确的方法是通过 CCK API 处理所有事情,这涉及编写 cron 实现或 drush 脚本。
这给你留下了一个非常好的选择:创建一个模块,定义它自己的内容类型。这样的模块有机会以任何它想要的方式定义所有字段(没有 CCK,只有
$node->foo
)。这是一个很好的模式,例如创建具有来自外部服务的内容的节点。假设有一个 $node->price 字段,其中的价格是从某些外部 SOAP 服务检索的。
当您拥有旧数据库并需要从中读取、写入或更新数据时,这也是一个很好的模式。
这种方法的另一个好处是您可以轻松限制操作:例如只读,或创建和读取但不更新。 CCK 不允许这样的事情(轻易地)。
Using CCK for this is a really bad idea.
Your external script would need to take all this into consideration. The only proper way, would be to process everything trough the CCK API, which involves writing cron-implementations or drush scripts.
This leaves you one really nice option: Make a module, which defines its own content-types. Such a module gets the opportunity to define all the fields (no CCK, just
$node->foo
) in any way it wants.This is a good pattern to e.g. create nodes that have content from external services. Say, a $node->price field, where the price is retrieved from some external SOAP service.
This is also a good pattern when you have legacy databases, where you need to read, write or update data from.
Another benefit of this approach is that you can easily limit the actions: e.g. readonly, or create&read but no update. CCK does not allow such things (easily).