I want to create page in admin side using module. I need to mention the custom link page using hook_menu(). After accessing the link from browser, I want to display some links for calling another static links from another website.
For Example :
I want to create admin/list-of-links : custom url
After clicking on this, on this page, the result would be like table listing with button for navigation of that static links from another website.
I have created followings.
By using following code, I have created custom page with assignment of the custom template file, by passed static links and printed that in the custom template page. Please note, I have just printed array in the template page. The formatting is remaining.
<?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);
?>