在drupal 6中。我有这个hook_menu()。
$items['graph'] = array(
'title' => t('Sample Graphs'),
'page callback' => 'graph_content',
'type' => MENU_CALLBACK,
'access arguments' => array('access content'),
);
$items['graph/line_graph'] = array(
'title' => t('Line Graph'),
'page callback' => 'line_graph_content',
'type' => MENU_CALLBACK ,
'access arguments' => array('access_content'),
);
我想转到折线图的另一个页面。当我转到'?q = graph'时,它会调用graph_content函数。它正在工作,但当我去'?q = graph / line_graph'时,同样的函数调用它。 'graph'和'line_graph'的输出是相同的。他们在同一模块谁可以帮我解决这个问题?谢谢!
答案 0 :(得分:0)
我在自定义模块中测试了您的代码,它对我有用。我有两个不同的输出。测试它,让我知道它是否适合你。
function mymodule_menu() {
$items['graph'] = array(
'title' => t('Sample Graphs'),
'page callback' => 'graph_content',
'type' => MENU_CALLBACK,
'access arguments' => array('access content'),
);
$items['graph/line_graph'] = array(
'title' => t('Line Graph'),
'page callback' => 'line_graph_content',
'type' => MENU_CALLBACK,
'access arguments' => array('access_content'),
);
return $items;
}
function graph_content(){
return 'hello '. __FUNCTION__;
}
function line_graph_content(){
return 'hello '. __FUNCTION__;
}