老葛的Drupal培训班 Think in Drupal
因为遗留数据库应该已经存在了,所以这个模块实际上不需要这个安装文件。我们这样做,仅仅是为了确保有一个遗留数据库表和数据供我们测试。我们应该在模块中的调整查询语句,让其连接到已有的非Drupal表上。在下面的查询语句中,假定数据存放在一个非Drupal数据库中, 使用settings.php文件中的$db_url['legacy']定义该数据库链接。
接着,创建sites/all/modules/custom/legacysearch/legacysearch.info,并添加以下内容:
; $Id$
name = Legacy Search
description = Example of indexing/searching external content with Drupal.
package = Pro Drupal Development
core = 6.x
最后,创建sites/all/modules/custom/legacysearch/legacysearch.module,并添加以下代码:
<?php
// $Id$
/**
* @file
* Enables searching of non-Drupal content.
*/