Frage

in drupal 6. i have this 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'),
  );

i want to go to another page for the line graph. When i go to '?q=graph' it calls the graph_content function. it is working but when I go to '?q=graph/line_graph', the same function call it. the output of 'graph' and 'line_graph' are the same. They are in the same module Who can help me with this issue? THANKS!!

War es hilfreich?

Lösung

I tested your code in a custom module and it working for me. I have two differents outputs. Test it and let me know if it working for you.

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__;
} 
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top