这是我的 custom.info
name = Custom
description = Custom module
core = 7.x
package = Own
和 custom.module
<?php
/**
* @file
* An example custom module for selecting, updating and deleting query
*/
/**
* Implementation of hook_block_info()
*/
echo 'Today: \n';
echo date('m/d/Y');
function custom_block_info() {
$block['custom'] = array('info' => t('Custom block'))
return $block;
}
/**
* Implements hook_block_view.
*/
function custom_block_view($delta = '') {
global $user;
$block['content'] = t('Hello @user from IP @host',array(
'@user' => format_username($user),
'@host' => $user->hostname`enter code here`
));
$result = db_select('node','a')
->fields('a', array('title'))
->execute();
foreach($result as $node) {
$items[] = array(
'data' => t($node->title)
);
}
$block['content'] .= theme('item_list', array(
'items' => $items
));
return $block;
}
但是这个自定义模块没有在我放置块的侧边栏中显示数据。我已将 echo 语句放在代码上方,它甚至没有在块中显示 echo 语句,谁能告诉我如何解决这个问题????
PS我已经安装了drupal,我在数据库中没有改变任何东西!