2009年11月21日星期六

Creating a menu item with a dynamic title

come from:http://thedrupalblog.com/creating-menu-item-dynamic-title
<?php
// define hook_menu to create menu item
function MYMODULE_menu() {
$items = array();

$items['MY/PAGE/URL/%'] = array(
'page callback' => 'MY_PAGE_CALLBACK_FUNCTION',
'title callback' => 'MY_PAGE_CALLBACK_TITLE_FUNCTION',
'title arguments' => array(3),
'type' => MENU_CALLBACK,
);

return
$items;
}

// define title callback function
function MY_PAGE_CALLBACK_TITLE_FUNCTION($arg) {
return
"My dynamic title: " . $arg;
}
?>


没有评论:

发表评论