0
我想使用模塊在管理端創建頁面。我需要使用hook_menu()來提到自定義鏈接頁面。從瀏覽器訪問鏈接後,我想顯示一些鏈接,以便從另一個網站調用另一個靜態鏈接。如何在drupal 7中創建具有自定義鏈接的自定義頁面?
例如:
我想創建一個管理員/列表的鏈接:自定義網址
點擊此之後,這個頁面上,其結果必然是像表按鈕,列出的導航來自另一個網站的靜態鏈接。
我創建了以下內容。
通過使用以下代碼,我創建了具有自定義模板文件分配的自定義頁面,通過傳遞靜態鏈接並將其打印在自定義模板頁面中。請注意,我剛剛在模板頁面上打印了數組。格式是剩餘的。
<?php
// Created Custom URL for accesing the static links
function test_menu() {
$items['admin/list-of-links'] = array(
'title' => 'List Section',
'page callback' => 'list_section',
'access arguments' => array('administrator'),
);
}
// Created Page Callback for assigning the variable for the theme
function list_section() {
$static_links = array("www.google.com", "www.facebook.com");
return theme('test_link', array('static_links' => $static_links));
}
// Assigned the template for the page that we have created
function test_theme($existing, $type, $theme, $path) {
return array(
'test_link' => array(
'template' => 'static-link-listing',
'path' => drupal_get_path('theme', 'seven') . "/templates"
),
);
}
//Created Template File : themes/seven/templates/static-link-listing.tpl.php
// And after that, I am getting the result.
// Now after that, we will format what output we need.
echo "<pre>";
print_r($static_links);
?>