Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Drupal 7模块未显示在列表中_Drupal_Drupal 7_Drupal Modules - Fatal编程技术网

Drupal 7模块未显示在列表中

Drupal 7模块未显示在列表中,drupal,drupal-7,drupal-modules,Drupal,Drupal 7,Drupal Modules,我创建了一个名为自定义视图的模块。它的目录是:sites/all/modules/custom\u views 目录中有两个文件,称为: custom_views.info 及 以下是.info文件的代码: ; Custom views created by me name = Custom Views description = Module to allow custom view development package = Custom Views core = 7.x php = 5.

我创建了一个名为自定义视图的模块。它的目录是:
sites/all/modules/custom\u views

目录中有两个文件,称为:

custom_views.info

以下是
.info
文件的代码:

; Custom views created by me
name = Custom Views
description = Module to allow custom view development
package = Custom Views
core = 7.x
php = 5.2
<?php
  function custom-views_views_default_views() {
  $views = array();
  $path = drupal_get_path('module', 'custom_views') . '/views';
  $files = drupal_system_listing('.inc$', $path, 'name', 0);
  foreach($files as $file) {
  include_once $file->filename;
  }
return $views;
}
?>
以下是
.module
文件的代码:

; Custom views created by me
name = Custom Views
description = Module to allow custom view development
package = Custom Views
core = 7.x
php = 5.2
<?php
  function custom-views_views_default_views() {
  $views = array();
  $path = drupal_get_path('module', 'custom_views') . '/views';
  $files = drupal_system_listing('.inc$', $path, 'name', 0);
  foreach($files as $file) {
  include_once $file->filename;
  }
return $views;
}
?>


由于某些原因,它将不允许我在模块列表中启用它,我无法找出原因。。。我还尝试了
清除缓存
。有人有什么想法吗?

请按照此处的文档进行操作

在您看到的地方,即使没有.module文件,您也应该拥有编写良好的模块


玩得开心

请遵循此处的文档

在您看到的地方,即使没有.module文件,您也应该拥有编写良好的模块


玩得开心

不确定这是否有助于您的模块显示在模块页面上,但我认为您的函数应称为custom_views_views_default_views(),而不是custom-View_views_default_views()

i、 e.函数名中的下划线不是破折号


可能Drupal只列出至少有一个有效函数的模块,但我不确定这是否有助于您的模块显示在模块页面上,但我认为您的函数应该称为custom_views_views_default_views(),而不是custom-View_views_default_views()

i、 e.函数名中的下划线不是破折号


可能Drupal只列出至少有一个有效函数的模块

正如其他答案中提到的,函数名是错误的。连字符应替换为下划线

再次检查模块位置

它应该位于下列文件夹之一中

  • /站点/所有/模块/您的_模块
  • /sites/domain.com/modules/your_module
  • /站点/所有/模块/您的_模块
信息文件

信息文件中只需要名称、说明和核心。首先删除除这些值之外的所有内容

name = Custom Views
description = Module to allow custom view development
core = 7.x
您指定的PHP版本是运行模块所需的最低PHP版本。听起来很明显,但您是否检查过运行>=5.2

检查模块文件夹和
.info
文件的权限。

当Drupal查找模块时,它在.info文件上使用
file\u exists()
,如果该文件不存在,或者由于权限或所有权不正确而无法访问,则返回false

文件的所有权也非常重要。检查信息文件的所有者是否与工作的模块之一匹配

编码


某些编码可能会阻止读取.info文件。通常应成功读取不带BOM的UTF8。

如其他答案中所述,函数名称错误。连字符应替换为下划线

再次检查模块位置

它应该位于下列文件夹之一中

  • /站点/所有/模块/您的_模块
  • /sites/domain.com/modules/your_module
  • /站点/所有/模块/您的_模块
信息文件

信息文件中只需要名称、说明和核心。首先删除除这些值之外的所有内容

name = Custom Views
description = Module to allow custom view development
core = 7.x
您指定的PHP版本是运行模块所需的最低PHP版本。听起来很明显,但您是否检查过运行>=5.2

检查模块文件夹和
.info
文件的权限。

当Drupal查找模块时,它在.info文件上使用
file\u exists()
,如果该文件不存在,或者由于权限或所有权不正确而无法访问,则返回false

文件的所有权也非常重要。检查信息文件的所有者是否与工作的模块之一匹配

编码


某些编码可能会阻止读取.info文件。通常应成功读取没有BOM的UTF8。

既然您已经尝试了所有其他建议问题,请尝试删除结束php标记

不确定这是否会导致您的特定问题,但建议您不要在模块文件中使用关闭php标记,因为如果关闭标记后有空格,您可能会遇到问题

您包含的其他文件也可能存在问题

如果您注释掉.module文件中的函数并尝试安装它会怎么样。
如果有效,则该函数或其包含的文件中存在问题。

由于您尝试了所有其他建议问题,请尝试删除关闭php标记

不确定这是否会导致您的特定问题,但建议您不要在模块文件中使用关闭php标记,因为如果关闭标记后有空格,您可能会遇到问题

您包含的其他文件也可能存在问题

如果您注释掉.module文件中的函数并尝试安装它会怎么样。
如果它工作正常,则说明该函数或它包含的文件有问题。

谢谢您的帮助。。。不幸的是,这对我没有帮助。我会继续找的。同时,您还有其他想法吗?请查看您的web服务器错误日志。示例:tail-f/var/log/apache2/error*.info文件是.ini语法<代码>是注释的正确符号lines@augusto-drupal的日志文件在哪里?@scapegoat17,您可以在这里找到更多详细信息,谢谢您的帮助。。。不幸的是,这对我没有帮助。我会继续找的。同时,您还有其他想法吗?请查看您的web服务器错误日志。示例:tail-f/var/log/apache2/error*.info文件是.ini语法<代码>是注释的正确符号lines@augusto-drupal的日志文件在哪里?@scapegoat17,您可以在这里找到更多详细信息,请尝试自定义视图默认视图