モジュールを使用して管理側でページを作成したいと思います。 hook_menu()を使ってカスタムリンクページについて言及する必要があります。ブラウザからリンクにアクセスした後、別のウェブサイトから別の静的リンクを呼び出すためのリンクを表示したい。例についてはdrupal 7でカスタムリンクを持つカスタムページを作成するには?
:
私は管理者/リストのリンクを作成したい:カスタムURL
この上でクリックした後は、このページには、結果はのナビゲーションのためのボタンで一覧表のようになりますその静的リンクは別のWebサイトから取得します。
私は以下を作成しました。
次のコードを使用して、カスタムテンプレートファイルの割り当て、渡された静的リンクによるカスタムページを作成し、カスタムテンプレートページに出力しました。注意してください、私はちょうどテンプレートページに配列を印刷しました。書式設定は残ります。
<?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);
?>