以下是我在.module文件定义的代码,请高手帮忙看看如何修改。谢谢
function demo_menu() {
$items['demo/room/%'] = array(
'title' => 'Page Title',
// describe the page for the menu system. site visitors will not see this
'description' => 'Simple custom hook_menu() implementation.',
'page callback' => 'demo_room',
'page arguments' => array(2),
'access arguments' => array('access content'),
);
return $items;
}
function demo_room($roomid){
global $user;
if (!$user->uid) {
return drupal_get_form('user_login');
}else{
global $language, $base_path,$user;
// Pass variables to the template.
$vars = array(
'language' => $language->language,
'title' => 'My Custom Login',
'favicon' => '',
'css' => $base_path . drupal_get_path('module', 'demo') . '/demo.css',
'user_id'=>$user->uid,
'roomid'=>$roomid,
);
//$html =theme('demo_room_template',$vars);
$html =theme('demo_room_template', array('vars' => $vars));
print $html;
}
}
function demo_theme(){
print_r("234");exit();//好像/hook_theme没有作用
return array(
'demo_room_template' => array(
// template file name will be demo-room.tpl.php
'template' => demo-room',
'variables' => array('vars' => NULL),
),
);
}