Dokuwiki 自動切換 Mobile 呈現頁面方式

因為最近開始使用 hTC Incredible S , 有這樣的需求, 很快找了一些現成的資料, 立即實現這樣的功能.

處理程序

  • 下載安裝 dokumobile Template

    cd /var/www/html/wiki/lib/tpl
    wget http://kjh.ca/dokumobile_2010_02_28.zip
    unzip dokumobile_2010_02_28.zip
  • 會出現 dokumobile 目錄, 然後修改 top_bar.php 第9-11行, 解決無法出現表頭圖樣的問題, 修改如下

         <td width="33%" style="border:0;" align="left"><img src="<?php echo DOKU_TPL?>images/icon_left.png" id="toggle_toc" /></td>
         <td width="33%" style="border:0;" align="center"><img src="<?php echo DOKU_TPL?>images/icon_middle.png" id="toggle_admin" /></td>
         <td width="33%" style="border:0;" align="right"><img src="<?php echo DOKU_TPL?>images/icon_right.png" id="toggle_nav" /></td>
  • 下載 Mobile_Detect.php 到 conf 目錄內

    cd /var/www/html/wiki/conf
    wget http://php-mobile-detect.googlecode.com/files/Mobile_Detect.php
  • 修改 inc/init.php 1)

    vi /var/www/html/wiki/inc/init.php
    • 在 72-77 行加入以下程式碼

      // for Mobile http://www.dokuwiki.org/template:dokumobile include(DOKU_CONF . "Mobile_Detect.php"); $mdetect = new Mobile_Detect(); if ($mdetect->isMobile()) {$conf['template']='dokumobile';}
    • 在原本 121-127 define Template baseURL, define real Template directory 要取消不執行

      #// define Template baseURL #if(!defined('DOKU_TPL')) define('DOKU_TPL', #        DOKU_BASE.'lib/tpl/'.$conf['template'].'/');  #// define real Template directory #if(!defined('DOKU_TPLINC')) define('DOKU_TPLINC', #        DOKU_INC.'lib/tpl/'.$conf['template'].'/');
Posted in 主题安装.

发表评论