Surance Center

XOOPS模块开发快速入门中文翻译(一)

  由于这两天一直研究XOOPS的模块,所以找到了这篇很好的模块开发快速入门。
看了以后,就兴致勃勃的来开发模块了,可是开发的过程中遇到一些问题。
应该是我看的太快了,要学而时习之啊。因此翻译在这里。
==============
作者:Surance Yin
邮箱:Suranceyin@yahoo.com.cn
主页:http://www.fltek.com.cn
=================



建立一个简单的模块

索引

  1. 模块的基本内容
  2. 建立清单
  3. 建立Mysql表
  4. 使用表单和数据库
  5. 显示数据库数据

此快速入门教你如何建立一个简单的模块.

第一步:下载右边的空白模块。.


Tutorial module
tutorial

模块的基本内容.

打开空白的模块,你会看到2php文件,一个images文件夹,里面有一个图片――这就是一个模块的开始。用一个php编辑器打开 xoops_version.php. 可以使用象dreamweaver等所见即所得的编辑器,也可以用 php Designer Maguma Open Studio (全部是免费的).

<?php
// 快速启动模块
// kaotik 发表

$modversion['name'] = "Tutorial";
$modversion['version'] = 1.00;
$modversion['description'] = "This is a tutorial module to teach how to build a simple module";
$modversion['author'] = "KaotiK";
$modversion['credits'] = "KaotiK";
$modversion['help'] = "";
$modversion['license'] = "GPL see LICENSE";
$modversion['official'] = 0;
$modversion['image'] = "images/tutorial.png";
$modversion['dirname'] = "tutorial";

// Admin
$modversion['hasAdmin'] = 0;

// Menu
$modversion['hasMain'] = 1;
?>

好,来一步一步的来看以上的代码.

<?php
// Tutorial Module
// Created by kaotik

此处讲解php的起点,略

$modversion['name'] = "Tutorial";
$modversion['version'] = 1.00;
$modversion['description'] = "This is a tutorial module to teach how to build a simple module";

这三行的意思是显而易见的。表示这个模块的名称、版本、描述。

$modversion['author'] = "KaotiK";
$modversion['credits'] = "KaotiK";
$modversion['help'] = "";

。Author 和 credits a也是很容易明白的.帮助 (如果用的话,当然这个模块里面不需要)要指向一个文件,比如说help.html help.php

$modversion['license'] = "GPL see LICENSE";
$modversion['official'] = 0;
$modversion['image'] = "images/tutorial.png";
$modversion['dirname'] = "tutorial";

License 是这个模块遵守的许可.记住,GPL表示你的模块尊数GPL协议。点击here了解更多. Official表示这是否是一个官方的模块。大多数情况下,将它设置为0就可以了。Image表示后台管理页面中这个模块的标志 。

// Admin
$modversion['hasAdmin'] = 0;

// Menu
$modversion['hasMain'] = 1;
?>

hasAdmin=0表示这个模块没有后台管理部分。如果需要将模块在主菜单中显示,将hasMain设置为1,否则就不会在主菜单中显示。如果hasAdmin和hasMain都设置为0,它也会显示在系统管理的“模块”菜单中,从而可以卸载这个模块。

posted @ 2008-04-17 20:33  xxp  阅读(2262)  评论(1编辑  收藏  举报
Surance Center