Page Top

概要 anchor.png

以前より、Xwordsモジュール をコメント統合で使ってはいましたが、携帯用テンプレートの共有化を行う際に、テンプレートにサイト毎に異なるd3forum_dirnameとforum_idを記述する部分で支障があり、何とかしたいと考え、Xwords-ver0.46をベースに手を入れてみました。

  1.  D3コメントクラスは、公開専用です。 一応、こんな風に表示されます。
    xwords_d3com_class.gif
  2.  コメント統合先のd3forumディレクトリ名・フォーラムid値は、d3blogのpicalのコメント統合を参考に、Xwordsの管理画面でmodule_configに保存する方式としました。 そして、コメント統合のクラスはd3forum-0.83a以降で実装された新方式(「d3comment」で呼ぶほう)を採用しています。 また、D3commentクラス内でforum_idまで認識するため、テンプレート内に記述する必要がありません。
     こうすることで、複数サイトを共有化している場合でも、携帯用のテンプレートを共通化できますし、テンプレート配布の際にも神経を使わずに済みます。
Page Top

手順と方法 anchor.png

テンプレートだけでなく、ソースの変更も必要ですので、細かく記しておきます。

なお、個別のアップロードも編集も面倒、という人のために、Xwords-ver0.46との差分ファイルパックを、ここに置いておきます。 解凍後、夫々のフォルダに上書きアップロードして使えます。

filexwords046b_diff.zipd3forum-0.85~
filexwords046a2_diff.zipd3forum-0.84以前
(09/03/21:d3forum-0.85に合わせて管理画面での設定項目追加、ほか)
(08/08/31:xwordsD3commentContent.class.php を変更)
Page Top

D3commentクラス anchor.png

 D3commentクラスは、下記ファイルをダウンロード後、「xwords/class」内にアップロードして使用します。

(09/03/21:config変数の変更)
(08/08/31:用語の属性(html,smiley,xcodes,br)を引いてサニタイズ処理に反映するようにした

 当然ながら、d3forumの方にコメント統合用に掲示板を追加し、(必要があれば)過去のxoopsコメントをインポート後、「コメント統合時の参照方法」に

xwords::xwordsD3commentContent

と記載します。(最初の「xwords」の部分は、インストールディレクトリ名に合わせて変更します。)
 なお、d3forumは0.83a以降のバージョンが必須で、D3commentの最新のAPIクラス群を忘れずにアップして下さい。

Page Top

Xwordsソースの変更 anchor.png

 (以下、ver-a2までの情報です。 ver-b以降の情報は、追って編集します。)
 3つのソースファイルに手を入れます。 こんな方法で良いのか自信はありませんが、間違いではないと思うのでご勘弁。 :-D

Page Top
xoops_version.php anchor.png

 「xoops_version.php」を編集し、管理画面にmodule_config項目を追加します。
 下記の388~402行目を追記します。

379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
$cf++;
$modversion['config'][$cf]['name'] = 'blocksperpage';
$modversion['config'][$cf]['title'] = "_MI_{$MYDIRNAME}_BLOCKSPERPAGE";
$modversion['config'][$cf]['description'] = "_MI_{$MYDIRNAME}_BLOCKSPERPAGEDSC";
$modversion['config'][$cf]['formtype'] = 'select';
$modversion['config'][$cf]['valuetype'] = 'int';
$modversion['config'][$cf]['default'] = 5;
$modversion['config'][$cf]['options'] = array( '0' => 0,'5' => 5, '10' => 10, '15' => 15, '20' => 20, '25' => 25, '30' => 30, '50' => 50 );
 
$cf++;
$modversion['config'][$cf]['name'] = 'com_agent';
$modversion['config'][$cf]['title'] = "_MI_{$MYDIRNAME}_COM_AGENT";
$modversion['config'][$cf]['description'] = "_MI_XWORDS_COM_AGENTDSC";
$modversion['config'][$cf]['formtype'] = 'textbox';
$modversion['config'][$cf]['valuetype'] = 'text';
$modversion['config'][$cf]['default'] = '';
 
$cf++;
$modversion['config'][$cf]['name'] = 'com_agent_forumid';
$modversion['config'][$cf]['title'] = "_MI_{$MYDIRNAME}_COM_AGENTID";
$modversion['config'][$cf]['description'] = "_MI_XWORDS_COM_AGENTIDDSC";
$modversion['config'][$cf]['formtype'] = 'textbox';
$modversion['config'][$cf]['valuetype'] = 'int';
$modversion['config'][$cf]['default'] = 0;
 
 
// On Install
if( ! empty( $_POST['fct'] ) && ! empty( $_POST['op'] ) && $_POST['fct'] == 'modulesadmin' && $_POST['op'] == 'install_ok' && $_POST['module'] != 'xwords' && $_POST['module'] == $mydirname && file_exists( XOOPS_ROOT_PATH . "/modules/{$mydirname}/include/oninstall.inc.php" ) )
    {
    include XOOPS_ROOT_PATH . "/modules/{$mydirname}/include/oninstall.inc.php" ;
    }
Page Top
languages/japanese/modinfo.php anchor.png

 「modinfo.php」を編集し、上の作業で追加した管理画面の項目に日本語テキストを追加します。
 以下の158~162行目を追記します。

150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
//Names of Blocks and Block information
define("_MI_{$MYDIRNAME}_ENTRIESNEW", "新着ブロック");
define("_MI_{$MYDIRNAME}_ENTRIESTOP", "人気ブロック");
define("_MI_{$MYDIRNAME}_RANDOMTERM", "ランダムブロック");
define("_MI_{$MYDIRNAME}_TERMINITIAL", "頭文字ブロック");
 
//define("_MI_{$MYDIRNAME}_NOTUJIS", "MYSQLの環境が default-character-set = %s です。<br />XOOPSを使用する上で支障があるかもしれません。");
 
define("_MI_{$MYDIRNAME}_COM_AGENT","コメントシステムの設定");
define("_MI_{$MYDIRNAME}_COM_AGENTDSC","d3forumのコメント統合機能を使用する場合は<br/>フォーラムのhtml側ディレクトリ名を指定します。<br/>xoopsコメントを使用する場合やコメント機能を無効にする場合は空欄です。");
 
define("_MI_{$MYDIRNAME}_COM_AGENTID","コメントのforum_id");
define("_MI_{$MYDIRNAME}_COM_AGENTIDDSC","コメント統合を選択した場合、forum_idを必ず指定してください。");
 
 
?>
Page Top
header.php anchor.png

 「header.php」に、下記のように56~65行目を追記します。
 module_config設定項目を、smarty変数でテンプレートに渡すために必要です。

54
55
56
57
58
59
60
61
62
63
64
65
66
67
$myts = & XwordsTextSanitizer::getInstance();
 
        // モジュールID  // added by naao
        $module_handler =& xoops_gethandler('module');
        $this_module =& $module_handler->getByDirname($mydirname);
        $mid = $this_module->getVar('mid');
 
        // モジュールconfig  // added by naao
        $config_handler =& xoops_gethandler("config");
        $mod_config = $config_handler->getConfigsByCat(0, $mid);
        $xoopsTpl->assign("moduleConfig", $mod_config);
 
 
?>
Page Top

テンプレートの編集 anchor.png

 続いて、テンプレートを1つ、Altsysなどで編集します。 

Page Top
xwords_entry.html anchor.png

 「xwords_entry.html」の、105~125行目 を以下のように編集します。

Everything is expanded.Everything is shortened.
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
<{if $moduleConfig.com_agent}>
  <{d3comment mydirname='xwords' id=$thisterm.id subject=$thisterm.term class="xwordsD3commentContent}>
<{else}>
 <{* comment nav block *}>
 <{if $commentsnav}>
  <div style="clear:both;margin:0.1em 0em;padding:0em;">
    <fieldset class="item" style="border:1px solid #778;margin:1em 0em;background-color:transparent;">
      <legend class="itemHead"><{$lang_comment}></legend>
      <div style="margin:1em 0em;padding:0em;text-align:center;line-height:1.3em;">
        <{$commentsnav}>
        <{$lang_notice}>
        <!-- start comments loop -->
        <{if $comment_mode == "flat"}>
          <{include file="db:system_comments_flat.html"}>
        <{elseif $comment_mode == "thread"}>
          <{include file="db:system_comments_thread.html"}>
        <{elseif $comment_mode == "nest"}>
          <{include file="db:system_comments_nest.html"}>
        <{/if}>
        <!-- end comments loop -->
      </div>
    </fieldset>
  </div>
 <{/if}>
<{/if}>
Page Top

モバイル用テンプレート anchor.png

 モバイルテンプハウスで、作成・公開中。 

Page Top

インストールと設定 anchor.png

 xoops管理画面の「モジュールの管理」で、「xwords」をモジュールアップデートします。 これで、「xwords」の管理画面に、2つの項目が追加されます。

xwords_config.gif

ここで、

  1. コメントシステムの設定 : d3forumのコメント統合機能を使用する場合はd3forumのhtml側ディレクトリ名を指定します。xoopsコメントを使用する場合やコメント機能を無効にする場合は空欄です。
  2. コメントのforum_id : コメント統合を選択した場合、統合先のforum_id値を必ず指定してください。

これらを設定すれば完了です。(この編集を行うまでは、xoopsコメントシステムが有効です。)

Page Top

その他 anchor.png

Page Top

ライセンス anchor.png

  • xwordsソース、d3forumソース、xugj_blockソース:GPL

トップ   凍結 差分 バックアップ 複製 名前変更 リロード印刷に適した表示   ページ新規作成 全ページ一覧 単語検索 最新ページの一覧   ヘルプ   最新ページのRSS 1.0 最新ページのRSS 2.0 最新ページのRSS Atom Powered by xpWiki
Counter: 4028, today: 1, yesterday: 0
初版日時: 2008-08-28 (木) 11:48:42
最終更新: 2019-08-17 (土) 07:11:56 (JST) (1711d) by なーお