Drupal问题,如何创建快速内容模块?

DFe*_*oso 1 drupal

嗨我需要在drupal中创建一个模块来显示一些数据,而不是一个drupal开发人员,在阅读了几个教程后,我似乎无法显示任何内容.

我有下一个代码:

<?php
function helloworld_perm() {
  return array('access helloworld content');
} 

function helloworld_listado(){
 return "yea";
}

function helloworld_menu(){
    $items = array();
    $items["listado"] = array(
        'title' => t('Listado de empresas'),
        'callback' => 'helloworld_listado',
        'access' => array('access helloworld content'),
        'type' => MENU_NORMAL_ITEM 
      );
    return $items;
}
Run Code Online (Sandbox Code Playgroud)

当我输入/ listado时,我获得拒绝访问您无权访问此页面.

知道我做错了什么吗?如果我转到admin-> module-> permissions,我已检查所有角色的权限以访问hellowold内容.

泰!

小智 6

从菜单数组的结构方式来看helloworld_menu(),我假设这是Drupal 6.如果是这样,你需要将'access'重命名为'access arguments'.见http://api.drupal.org/api/function/hook_menu/6.

Drupal API文档还包括一个评论很重的page_example.module,它基本上就是你在这里做的,你可能想要查看它:http://api.drupal.org/api/file/developer/examples/page_example .module/6 /源

希望有所帮助!

哦.并且不要忘记之后从管理>>站点配置>>性能上的"清除缓存"按钮清除缓存.