drupal 7新创建的自定义模块未显示在模块列表中
我是drupal新手,目前正在学习Drupal7 我指的是Drupal7的书 我试图创建我的第一个自定义模块 在书中提到,您可以在以下目录之一中创建模块 1) /sites/all/modules 2) /sites/default/modules 我的模块名称为第一个 我已在/sites/default/modules/first中创建了我的模块 在这个目录中有两个文件 1) first.info 2) 第一。模块 first.info文件的内容是drupal 7新创建的自定义模块未显示在模块列表中,drupal,drupal-7,Drupal,Drupal 7,我是drupal新手,目前正在学习Drupal7 我指的是Drupal7的书 我试图创建我的第一个自定义模块 在书中提到,您可以在以下目录之一中创建模块 1) /sites/all/modules 2) /sites/default/modules 我的模块名称为第一个 我已在/sites/default/modules/first中创建了我的模块 在这个目录中有两个文件 1) first.info 2) 第一。模块 first.info文件的内容是 ;$Id$ name = First des
;$Id$
name = First
description = A first module.
package = Drupal 7 Development
core = 7.x
files[] = first.module
;dependencies[] = autoload
;php = 5.4
<?php
// $Id$
/**
* @file
* A module exemplifying Drupal coding practices and APIs.
*
* This module provides a block that lists all of the
* installed modules. It illustrates coding standards,
* practices, and API use for Drupal 7.
*/
/**
* Implements hook_help().
*/
function first_help($path, $arg) {
if ($path == 'admin/help#first') {
return t('A demonstration module.');
}
}
?>
fisrt.module文件的内容为
;$Id$
name = First
description = A first module.
package = Drupal 7 Development
core = 7.x
files[] = first.module
;dependencies[] = autoload
;php = 5.4
<?php
// $Id$
/**
* @file
* A module exemplifying Drupal coding practices and APIs.
*
* This module provides a block that lists all of the
* installed modules. It illustrates coding standards,
* practices, and API use for Drupal 7.
*/
/**
* Implements hook_help().
*/
function first_help($path, $arg) {
if ($path == 'admin/help#first') {
return t('A demonstration module.');
}
}
?>
当我尝试检查模块列表时,我无法看到我创建的模块
我已经厌倦了清除缓存和检查仍然没有显示
谁能告诉我哪里错了
提前感谢模块位置
大多数人选择将模块放在
/sites/all/modules
或/sites/domain.com/modules
文件夹中(不是站点/默认…
)。对于大多数常见的Drupal安装,您应该将其放置在站点/all/modules
中
信息文件信息文件中只需要名称、说明和核心。首先删除除这些值之外的所有内容
name = First
description = A first module.
core = 7.x
有关更多信息,请参阅
一些注意事项:
- “package”属性“只能由大型多模块软件包使用”
- 您不需要在“files”属性中声明模块的
文件.module
- 现在删除注释掉的行。如果您的模块确实需要PHP5.4,那么您可以在完成故障排除后将其添加到后面
大多数人选择将模块放在
/sites/all/modules
或/sites/domain.com/modules
文件夹中(不是站点/默认…
)。对于大多数常见的Drupal安装,您应该将其放置在站点/all/modules
中
信息文件信息文件中只需要名称、说明和核心。首先删除除这些值之外的所有内容
name = First
description = A first module.
core = 7.x
有关更多信息,请参阅
一些注意事项:
- “package”属性“只能由大型多模块软件包使用”
- 您不需要在“files”属性中声明模块的
文件.module
- 现在删除注释掉的行。如果您的模块确实需要PHP5.4,那么您可以在完成故障排除后将其添加到后面
功能测试\u示例\u帮助($path,$arg){
交换机($path){
案例“管理/帮助#测试#示例”:
返回“”.t(“测试模块以查看它如何工作和显示”)。”;
打破
}
使用switch语句尝试以下示例,以查看它是否有效函数测试\u示例\u帮助($path,$arg){
交换机($path){
案例“管理/帮助#测试#示例”:
返回“”.t(“测试模块以查看它如何工作和显示”)。”;
打破
}
使用switch语句试试下面的示例,看看它是否有效。试着去掉标记php代码结尾的?>。这样做是为了防止空白区破坏HTTP头。试着去掉标记php代码结尾的?>。这样做是为了防止空白区破坏HTTP头。
我通过使用启动.info文件解决了这个问题
name = First
并对我的文件进行编码:
不带BOM的UTF-8
使用Notpade++时,您会发现它很简单。我通过使用启动.info文件解决了这个问题
name = First
并对我的文件进行编码:
不带BOM的UTF-8
使用Notpade++检查信息和模块文件上的文件名很容易。上面两个文件都有拼写错误(信息文件名有空格,模块文件名拼写错误)。检查信息和模块文件上的文件名。上面两个文件都有拼写错误(信息文件名有空格,模块文件名拼写错误)。