How do I use Drupal to report on data tables processed outside of Drupal?
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, b开发者_JS百科ut 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?
Using CCK for this is a really bad idea.
- CCK can only deal with the exact database architecture it creates. It is near to impossible to use existing CCK fields on an existing database architecture.
- CCK changes the database layout, based on its configuration. E.g. making a field "multiple", or re-using a field on another content-type will drastically re-order and normalize the database: creating new tables, removing columns and so on.
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).
精彩评论