Drupal问题,如何创建快速内容模块?
嗨,我需要在drupal中创建一个模块来显示一些数据,而不是作为drupal开发人员,在阅读了一些教程之后,我似乎什么都不能显示 我有下一个代码:Drupal问题,如何创建快速内容模块?,drupal,Drupal,嗨,我需要在drupal中创建一个模块来显示一些数据,而不是作为drupal开发人员,在阅读了一些教程之后,我似乎什么都不能显示 我有下一个代码: <?php function helloworld_perm() { return array('access helloworld content'); } function helloworld_listado(){ return "yea"; } function helloworld_menu(){ $items =
<?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;
}
根据菜单数组在helloworld\u menu()中的结构,我假设这是Drupal 6。如果是这样,您需要将“访问”重命名为“访问参数”。看
Drupal API文档还包括一个评论颇多的page_example.module,它基本上就是您在这里所做的,您可能想查看一下:
希望有帮助
哦。不要忘记在“管理”>“站点配置”>“性能”上的“清除缓存”按钮中清除缓存。从菜单数组在helloworld\u menu()中的结构来看,我假设这是Drupal 6。如果是这样,您需要将“访问”重命名为“访问参数”。看
Drupal API文档还包括一个评论颇多的page_example.module,它基本上就是您在这里所做的,您可能想查看一下:
希望有帮助
哦。另外,不要忘记在“管理”>“站点配置”>“性能”上的“清除缓存”按钮中清除缓存。对于hook\u菜单,您似乎混合使用了Drupal 5(数组内容)和Drupal 6(无$may\u缓存,$按路径索引的项)语法
如果您使用的是Drupal 6,则应如下所示:
<?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'),
'page callback' => 'helloworld_listado',
'access arguments' => array('access helloworld content'),
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
?>
请注意,MENU\u NORMAL\u项
是“type”的默认值,您无需指定它
此外,正如我们尊敬的webchick刚才所说的,您可以在她指向的页面上找到详细的解释。看起来您在使用Drupal 5(数组内容)和Drupal 6(无$may_缓存,$items by path索引)语法的组合来创建hook_菜单
如果您使用的是Drupal 6,则应如下所示:
<?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'),
'page callback' => 'helloworld_listado',
'access arguments' => array('access helloworld content'),
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
?>
请注意,MENU\u NORMAL\u项
是“type”的默认值,您无需指定它
此外,正如我们尊敬的webchick刚才所说,您可以在她指向的页面上找到详细的解释。仅供参考,上面的链接已移至
仅供参考,上面的链接已移至
请注意,菜单项
是类型
的默认值,您不需要指定它
另外,正如我们尊敬的网络商城刚刚所说
请注意,菜单项
是类型
的默认值,您不需要指定它
另外,正如我们尊敬的网络商城刚刚所说