关闭

Drupal——module开发实现hello world

标签: drupal
825人阅读 评论(0) 收藏 举报
分类:

File: /sites/all/modules/mymodule/mymodule.info


name = mymodule
description = test proof of concept module
package = public-action
version = VERSION
core = 7.x
files[] = mymodule.module
; Information added by drupal.org packaging script on 2010-03-21
version = "7.0-alpha3"
project = "drupal"
datestamp = "1269192313"



File: /sites/all/modules/mymodule/mymodule.module



<?php
function mymodule_menu() {
    $items = array();
    $items['my_module/hello_world'] = array(
        'title' => 'Hello World Test',
        'page callback' => 'say_hello_world',
        'access arguments' => array('access content'),
        'type' => MENU_CALLBACK,
     );
    return $items;
}
function say_hello_world() {
    $vars = array();
    $vars['type']="ul";
    $vars['title'] = "";
    $vars['attributes']=array("");
    $vars['items'][0]="This is a simple proof of concept module";
    return theme_item_list($vars);
}


然后通过路径my_module/hello_world即可访问

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:31364次
    • 积分:575
    • 等级:
    • 排名:千里之外
    • 原创:14篇
    • 转载:71篇
    • 译文:1篇
    • 评论:0条
    文章分类