我正在创建一个让您的用户添加提要的模块。 所以我想我的代码提供可以在主题层覆盖的选项卡。使用标签创建drupal 6模块
我想这可能与hook_menu来完成:
$items['tab_add_feed'] = array(
'title' => 'Add Feed',
'page callback' => 'xml_parser_add_feed',
'access callback' => 'user_access',
'access arguments' => array('manage own feeds'),
'type' => MENU_LOCAL_TASK,
);
像上面。 但我在网站的正面使用它。
如何在页面顶部添加制表符或链接drupal方式?
//编辑
有没有标签存在的那一刻,也许我必须让他们看到?
通过将<a href="xml_parser/add_feed">add feed</a>
添加到主页面回调函数来修复它 但是,这是丑陋的,硬编码的,而不是主题性的。等待更好的解决方案。
//编辑
这是我使用的代码现在
function xml_parser_menu() {
$items = array();
$items['xml_parser'] = array(
'path' => 'xml_parser',
'title' => t('Feed'),
'description' => t('Add/edit feeds'),
'page callback' => 'xml_parser_manage_overview',
'access callback' => 'user_access', // get user access
'access arguments' => array('manage own feeds'), // check user if premission is set
'type' => MENU_NORMAL_ITEM,
'menu_name' => 'primary-links', // add to primary menu
);
$items['xml_parser/add_feed'] = array(
'path' => 'xml_parser/add_feed',
'title' => 'Add Feed',
'page callback' => 'xml_parser_add_feed',
'access callback' => 'user_access',
'access arguments' => array('manage own feeds'),
//'access' => user_access('maintain own subscriptions'),
'type' => MENU_LOCAL_TASK,
);
return $items;
}
在您的代码中存在访问参数错误。这需要数组的值; 'access arguments'=> array('manage own feeds'), – Bladedu 2010-11-02 14:07:04
thnx,我现在编辑了代码 – FLY 2010-11-03 09:41:58