我正在尝试为Drupal开发一个模块,我很新。包含的文件显示在模板外部
以下一段代码运行良好,除了包含的文件。包含文件的内容显示在模板外部,其余部分正确显示在模板内部。为什么会发生这种情况以及如何解决此问题?
drupal_add_css(drupal_get_path('module', 'helloworld') . '/helloworld.css', array('group' => CSS_DEFAULT, 'every_page' => TRUE));
function helloworld_menu(){
$items = array();
$items['helloworld'] = array(
'title' => t('Hello world'),
'page callback' => 'helloworld_output',
'access arguments' => array('access content'),
);
return $items;
}
function helloworld_display(){
include_once (dirname(__FILE__) . '/helloworld.display.php');
}
/*
* Display output
*/
function helloworld_output() {
header('Content-type: text/plain; charset=UTF-8');
header('Content-Disposition: inline');
$output = "<div id='hw_wrapper'>";
$output .= helloworld_display();
$output .= 'hej';
$output .= "</div>";
return $output;
}
helloworld.display.php文件的内容是什么? – kiamlaluno
just <?php \t echo“Another hello world”;所以这不应该造成这个我认为 – mhmdrupal