Title1

Title2

Title3

5. modules 2.5x

一、改造模組

  1. 將原模組 admin/index.php 改為 main.php

  2. XOOPS250ModuleConversionFiles\admin 下的檔案除了 menu.php、main.php 以外的所有檔案,均複製到原模組的 admin 下

  3. 複製XOOPS250ModuleConversionFiles\class、css、docs 

  4. 複製XOOPS250ModuleConversionFiles\images\admin及icons

  5. 複製XOOPS250ModuleConversionFiles\language\語系\help及changelog.txt

  6. 修改\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

三、修改\language\語系\modinfo.php,在最前面加入:

include_once XOOPS_ROOT_PATH."/modules/tadtools/language/{$xoopsConfig['language']}/modinfo_common.php";

四、修改menu.php

$adminmenu = array();
$icon_dir=substr(XOOPS_VERSION,6,3)=='2.6'?"":"images/";

$i = 1;
$adminmenu[$i]['title'] = _MI_TAD_ADMIN_HOME ;
$adminmenu[$i]['link'] = 'admin/index.php' ;
$adminmenu[$i]['desc'] = _MI_TAD_ADMIN_HOME_DESC ;
$adminmenu[$i]['icon'] = 'images/admin/home.png' ;

$i++;
$adminmenu[$i]['title'] = _MI_TADXXX_ADMENU1;
$adminmenu[$i]['link'] = "admin/main.php";
$adminmenu[$i]['desc'] = _MI_TADXXX_ADMENU1_DESC ;
$adminmenu[$i]['icon'] = "images/admin/folder_txt.png";

$i++;
$adminmenu[$i]['title'] = _MI_TAD_ADMIN_ABOUT;
$adminmenu[$i]['link'] = 'admin/about.php';
$adminmenu[$i]['desc'] = _MI_TAD_ADMIN_ABOUT_DESC;
$adminmenu[$i]['icon'] = 'images/admin/about.png';
  1. 掉圖示 http://findicons.com

  2. 根據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;

?>

  1. 請根據樣板檔設定產生相關真實檔案

  2. 修改logologo_english.png、logo_tchinese.png、logo_tchinese_utf8.png

  3. 修改changelog.txt

  4. 刪除common

  5. 刪除admin/header_admin.php

七、修改header.php

  1. 刪掉common$module_css$module_menu等設定

  2. 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";
    }

     

八、修改function.php

//引入TadTools的函式庫
if(!file_exists(XOOPS_ROOT_PATH."/modules/tadtools/tad_function.php")){
 redirect_header("http://www.tad0616.net/modules/tad_uploader/index.php?of_cat_sn=50",3, _TAD_NEED_TADTOOLS);
}
include_once XOOPS_ROOT_PATH."/modules/tadtools/tad_function.php";

九、修改後台

  1. 修改admin/main.php
    /*-----------引入檔案區--------------*/
    $xoopsOption['template_main'] = "tg_adm_main_tpl.html";
    include_once "header.php";
    include_once "../function.php";
    
    
    
    include_once 'footer.php';
    ?>

     

  2. 修改後台樣板檔

十、修改前台

  1. 修改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';

     

  2. 修改前台樣板檔
     

    <{$bootstrap}>
    <{$jquery}>
    <{$toolbar}>

     

  3. 常用樣板標籤
     

    $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>

     

  4.  

十一、常用bootstrap

版型
<div class="row-fluid"></div>
區塊
<div class="well well-small"></div>
<div class="hero-unit"></div>
表格
<table class="table table-striped table-bordered table-hover">
按鈕
<a class="btn btn-mini btn-info">
觀看 儲存 btn btn-primary
啟用 新增 btn btn-info
管理 複製 btn btn-success
隱藏 編輯 btn btn-warning
刪除 btn btn-danger
btn btn-inverse
btn btn-link
表單
<div class="controls controls-row">
<input class="span4" type="text" placeholder=".span4"> 
<input class="span1" type="text" placeholder=".span1">
</div>

<form>
  <fieldset>
    <legend>Legend</legend>
    <label>標籤</label>
    <input type="text" placeholder="Type something…">
    <span class="help-block">說明</span>
    
    <button type="submit" class="btn">送出</button>
  </fieldset>
</form>
複選
<label class="checkbox inline">
<input type="checkbox" value="">  多選方框
</label>
單選
<label class="radio inline">
<input type="radio" name="名稱" id="唯一" value="值" checked>單選圓框
</label>
圖片
class="img-rounded img-polaroid" 


浮動
<div class="pull-left"></div>
<div class="clearfix"></div>
徽章
<span class="badge">1</span>
<span class="badge badge-success">2</span>
<span class="badge badge-warning">4</span>
<span class="badge badge-important">6</span>
<span class="badge badge-info">8</span>
<span class="badge badge-inverse">10</span>
標籤
<span class="label">預設</span>
<span class="label label-success">成功</span>
<span class="label label-warning">警告</span>
<span class="label label-important">重要</span>
<span class="label label-info">資訊</span>
<span class="label label-inverse">相反色</span>