XOOPS模組開發記錄
-
將原模組 admin/index.php 改為 main.php
-
將XOOPS250ModuleConversionFiles\admin 下的檔案除了 menu.php、main.php 以外的所有檔案,均複製到原模組的 admin 下
-
複製XOOPS250ModuleConversionFiles\class、css、docs
-
複製XOOPS250ModuleConversionFiles\images\admin及icons
-
複製XOOPS250ModuleConversionFiles\language\語系\help及changelog.txt
-
修改\language\語系\admin.php,在最前面加入:
include_once "../../tadtools/language/{$xoopsConfig['language']}/admin_common.php"; define("_TAD_NEED_TADTOOLS","Need modules/tadtools. You can download tadtools from <a href='http://www.tad0616.net/modules/tad_uploader/index.php?of_cat_sn=50' target='_blank'>Tad's web</a>."); include_once "../../tadtools/language/{$xoopsConfig['language']}/admin_common.php"; define("_TAD_NEED_TADTOOLS"," 需要 tadtools 模組,可至<a href='http://www.tad0616.net/modules/tad_uploader/index.php?of_cat_sn=50' target='_blank'>Tad教材網</a>下載。");
_TO_ADMIN_PAGE _MD_HOMEPAGE _BACK_MODULES_PAGE _BP_DEL_CHK _MA_SAVE //以下直接將 「_BP_」取代為「_TAD_」即可 _BP_BACK_PAGE _BP_NEXT_PAGE _BP_FIRST_PAGE _BP_LAST_PAGE _BP_GO_BACK_PAGE _BP_GO_NEXT_PAGE _BP_TOOLBAR _BP_EDIT _BP_FUNCTION _BP_DEL _BP_ADD _BP_FOR |
_TAD_TO_ADMIN _TAD_TO_MOD _TAD_DEL_CONFIRM _TAD_SAVE
_TAD_BACK_PAGE _TAD_NEXT_PAGE _TAD_FIRST_PAGE _TAD_LAST_PAGE _TAD_GO_BACK_PAGE _TAD_GO_NEXT_PAGE _TAD_TOOLBAR _TAD_EDIT _TAD_FUNCTION _TAD_DEL _TAD_ADD _TAD_FOR |
-
換掉圖示 http://findicons.com
-
根據menu.php新增或修改台樣板檔
五、修改後台樣板檔
<link rel="stylesheet" type="text/css" media="screen" href="<{$xoops_url}>/modules/tadtools/bootstrap/css/bootstrap.css" /> <link rel="stylesheet" type="text/css" media="screen" href="<{$xoops_url}>/modules/tadtools/bootstrap/css/bootstrap-responsive.css" /> <link rel="stylesheet" type="text/css" media="screen" href="<{$xoops_url}>/modules/tadtools/css/xoops_adm.css" /> 六、修改mainfile.php
<?php $modversion = array();
//---模組基本資訊---// $modversion['name'] = _模組中文名稱; $modversion['version'] = 1.00; $modversion['description'] = _模組說明; $modversion['author'] = _作者姓名; $modversion['credits'] = _相關有功人員; $modversion['help'] = 'page=help'; $modversion['license'] = 'GNU GPL 2.0'; $modversion['license_url'] = 'www.gnu.org/licenses/gpl-2.0.html/'; $modversion['image'] = "images/logo_{$xoopsConfig['language']}.png"; $modversion['dirname'] = basename(dirname(__FILE__));
//---模組狀態資訊---// $modversion['release_date'] = '2013/06/6'; $modversion['module_website_url'] = 'http://tad0616.net/'; $modversion['module_website_name'] = _MI_TAD_WEB; $modversion['module_status'] = 'release'; $modversion['author_website_url'] = 'http://tad0616.net/'; $modversion['author_website_name'] = _MI_TAD_WEB; $modversion['min_php']=5.2; $modversion['min_xoops']='2.5';
//---paypal資訊---// $modversion ['paypal'] = array(); $modversion ['paypal']['business'] = 'tad0616@gmail.com'; $modversion ['paypal']['item_name'] = 'Donation : ' . _MI_TAD_WEB; $modversion ['paypal']['amount'] = 0; $modversion ['paypal']['currency_code'] = 'USD';
//---模組資料表架構---// //$modversion['sqlfile']['mysql'] = 'sql/mysql.sql'; //$modversion['tables'][0] = '';
//---後台使用系統選單---// $modversion['system_menu'] = 1;
//---後台管理介面設定---// $modversion['hasAdmin'] = 1; $modversion['adminindex'] = 'admin/index.php'; $modversion['adminmenu'] = 'admin/menu.php';
//---前台主選單設定---// $modversion['hasMain'] = 1; //$modversion['sub'][1]['name'] = ''; //$modversion['sub'][1]['url'] = '';
//---模組自動功能---// //$modversion['onInstall'] = "include/install.php"; //$modversion['onUpdate'] = "include/update.php"; //$modversion['onUninstall'] = "include/onUninstall.php";
//---偏好設定---// $modversion['config'] = array(); //$modversion['config'][0]['name'] = '偏好設定名稱(英文)'; //$modversion['config'][0]['title'] = '偏好設定標題(常數)'; //$modversion['config'][0]['description'] = '偏好設定說明(常數)'; //$modversion['config'][0]['formtype'] = '輸入表單類型'; //$modversion['config'][0]['valuetype'] = '輸入值類型'; //$modversion['config'][0]['default'] = 預設值;
//---搜尋---// //$modversion['hasSearch'] = 1; //$modversion['search']['file'] = "include/search.php"; //$modversion['search']['func'] = "搜尋函數名稱";
//---區塊設定---// //$modversion['blocks'] = array(); //$modversion['blocks'][1]['file'] = "區塊檔.php"; //$modversion['blocks'][1]['name'] = 區塊名稱(常數); //$modversion['blocks'][1]['description'] = 區塊說明(常數); //$modversion['blocks'][1]['show_func'] = "執行區塊函數名稱"; //$modversion['blocks'][1]['template'] = "區塊樣板.html"; //$modversion['blocks'][1]['edit_func'] = "編輯區塊函數名稱"; //$modversion['blocks'][1]['options'] = "設定值1|設定值2";
//---樣板設定---// $modversion['templates'] = array(); $i=1; //$modversion['templates'][$i]['file'] = 'xxx.html'; //$modversion['templates'][$i]['description'] = ''; //$i++; //$modversion['templates'][$i]['file'] = 'xxx.html'; //$modversion['templates'][$i]['description'] = '';
//---評論---// //$modversion['hasComments'] = 1; //$modversion['comments']['pageName'] = '單一頁面.php'; //$modversion['comments']['itemName'] = '主編號';
//---通知---// //$modversion['hasNotification'] = 1; ?> |
-
請根據樣板檔設定產生相關真實檔案
-
修改logo為logo_english.png、logo_tchinese.png、logo_tchinese_utf8.png
-
修改changelog.txt
-
刪除common
-
刪除admin/header_admin.php
七、修改header.php
-
刪掉common及$module_css、$module_menu等設定
-
include_once "../../mainfile.php";
include_once "function.php";
//判斷是否對該模組有管理權限
$isAdmin=false;
if ($xoopsUser) {
$module_id = $xoopsModule->getVar('mid');
$isAdmin=$xoopsUser->isAdmin($module_id);
}
$interface_menu[_TAD_TO_MOD]="index.php";
if($isAdmin){
$interface_menu[_TAD_TO_ADMIN]="admin/main.php";
}
- 修改admin/main.php
/*-----------引入檔案區--------------*/
$xoopsOption['template_main'] = "tg_adm_main_tpl.html";
include_once "header.php";
include_once "../function.php";
include_once 'footer.php';
?>
- 修改後台樣板檔
- 修改index.php
/*-----------引入檔案區--------------*/
include "header.php";
$xoopsOption['template_main'] = "tg_list_tpl.html";
include_once XOOPS_ROOT_PATH."/header.php";
include_once XOOPS_ROOT_PATH.'/footer.php';
-
修改前台樣板檔
<{$bootstrap}> <{$jquery}> <{$toolbar}>
-
常用樣板標籤
$xoopsTpl->assign( "toolbar" , toolbar_bootstrap($interface_menu)) ; $xoopsTpl->assign( "bootstrap" , get_bootstrap()) ; $xoopsTpl->assign( "jquery" , get_jquery(true)) ; $xoopsTpl->assign( "isAdmin" , $isAdmin) ; <{$smarty.const._常數}> <{foreach item=xxx from=$ooo}> <{/foreach}> 分欄位 <{assign var="i" value=0}> <{assign var="total" value=1}> <{foreach item=class from=$data}> <{if $i==0}> <div class="row-fluid"> <{/if}> <div class="span3"> 內容 </div> <{assign var="i" value=$i+1}> <{assign var="total" value=$total+1}> <{if $i == 4 || $total==$count}> </div> <{assign var="i" value=0}> <{/if}> <{/foreach}> <div class="clearfix"></div>
-