-2
我是Drupal的新手,我使用PHP製作了一個自定義模塊,它顯示學生信息列表,並且想要調用它,點擊子菜單項,名爲學生信息。請引導我逐步步驟程序。如何在Drupal中調用自定義模塊
我是Drupal的新手,我使用PHP製作了一個自定義模塊,它顯示學生信息列表,並且想要調用它,點擊子菜單項,名爲學生信息。請引導我逐步步驟程序。如何在Drupal中調用自定義模塊
查找生成「頁面回調」(實際上使drupal中的URL生效)的起始位置是hook_menu。建議看看文檔,但實際使您的回調工作的起點將在my_module.module文件中:
/**
* Implements hook_menu().
*/
function my_module__menu() {
$items = array();
$items['student-info'] = array(
'title' => 'Student Info', // This becomes the page title
'description' => 'Information about students.', // this is the link description
'page callback' => 'function_name_that_outputs_content', // this is the page callback function that will fire
'type' => MENU_CALLBACK, // this is the type of menu callback, there are several that you can use depending on what your needs are.
);
return $items; // make sure you actually return the items.
}
/**
* Output the page contents when someone visits http://example.com/student-info.
*/
function function_name_that_outputs_content() {
$output = 'My page content'
return $output;
}
歡迎來到Stack,Neetu!請給我們一些代碼和例子,以便我們可以幫助您解決您的問題。 –
請在閱讀文檔之前閱讀以下內容:https://www.drupal.org/docs/7/creating-custom-modules – Fky