增加module:myblog module
/sites/default/modules/myblog/myblog.info
;$Id$
name = Myblog
description = custom blog.
package = Core
version = VERSION
core = 7.x
; Information added by drupal.org packaging script on 2012-02-01
version = "7.12"
project = "drupal"
datestamp = "1328134560"
/sites/default/modules/myblog/myblog.module
<?php
// $Id$
/**
* Implements hook_help
*/
function myblog_help() {
return t('aaaa');
}
/**
* Implement hook_block_info
*/
function myblog_block_info() {
$blocks = array();
$blocks['list_modules'] = array(
'info' => t('list myblog'),
'cache' => DRUPAL_NO_CACHE
);
return $blocks;
}
/**
* Implement hook_block_view
*/
function myblog_block_view($block_name='') {
if ($block_name == 'list_modules') {
$list = array('hhy');
$theme_args = array('node' => 'aa');
$content = theme('test', $theme_args);
$content = theme('abtest', $theme_args);
//echo $content;
$block = array(
'subject' => t('enable myblog module'),
'content' => $content
);
return $block;
}
}
function theme_test($arg) {
// debug_print_backtrace();
echo 'fggg';
}
/**
* Implements hook_theme().
*/
function myblog_theme() {
return array(
'test' => array(
'variables' => array('node' => NULL),
),
'abtest' => array(
'template' => 'abtest',
'render element' => 'content',
),
);
}
/**
* Implements hook_node_load()
*/
function myblog_node_load($nodes, $types) {
echo 'nodetest';
}
/**
* Implements hook_node_view()
*/
function myblog_node_view($nodes, $types) {
echo 'nodetestview';
}
/**
* Implements hook_menu
*/
function myblog_menu() {
$items['myblog'] = array(
'title' => 'myblog-ocean',
'page callback' => 'blog_page_last',
'access arguments' => array('access content'),
'type' => MENU_SUGGESTED_ITEM,
'file' => 'blog.pages.inc',
'file path' => drupal_get_path('module', 'blog'),
);
return $items;
}
在模板中加page--myblog.tpl
<?php print render($page['content']); ?>