我想创建一个完整页面自定义模块。通过这个,我的意思是一个不包含在主要Drupal站点中的模块。这里是我的代码:Drupal 7创建整页自定义模块
myapp.module:
function myapp_menu()
{
$result = array();
$result['myapp/home'] = array(
'title' => 'My App Title', // Title of our page
'description'=> 'My App Web Site', // Description of our page
'page callback' => 'myapp_function',
'access arguments' => array('access content'), // permission to access this page
'type' => MENU_NORMAL_ITEM, // type of menu item
);
return $result;
}
function myapp_function(){
return theme('my_custom_template');
}
function myapp_theme(){
return array(
'my_custom_template' => array(
'template' => 'myapp-page',
),
);
}
MYAPP-page.tpl.php中
Hello World
的问题是,在显示页面时,它仍然保持内主要的Drupal站点主要主题。我想使这个页面成为它自己的完整页面网站。任何人都可以帮助做到这一点?
感谢
伟大的工作。但是,你提到这是一个“黑客”。这是不是皱起了眉头?还是有一种“黑客”方法? – jason
我不太确定,但你也可以通过网址创建另一个主题(自定义)和案例https://drupal.stackexchange.com/questions/812/how-do-i-change-a-theme-based- on-the-url,或尝试hook_theme声明中的所有选项。但简单而有效的方法就是这种破解 – Fky