Page Top

概要 anchor.png

以前より、minidiaryモジュール をコメント統合で使いたいとは思っていましたが、D3コメントクラスを書く時間がようやく取れたので、minidiary-ver0.14をベースに手を入れてみました。

  1.  D3コメントクラスです。 一応、こんな風に表示されます。
    yd_d3com_class.gif
     (08/09/07 ver-b1変更) 権限チェック~リダイレクトを組み込みました。 参考にした記事は、こちら(XUGJ)
     (ご注意:)d3forumの投稿一覧表示などには、タイトル・投稿者などが表示されますが、それをクリックしても本分要旨やコメントが表示されずにリダイレクトされます。

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

  3.  コメント一覧ブロックは、xugj_blockで実装しています。(参考記事:thx さやさんのコメント13)
      (08/09/07 ver-b1変更) 「表示中の執筆者へのコメントを絞り込んで表示」を実装しました。


Page Top

手順と方法 anchor.png

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

なお、個別のアップロードも編集も面倒、という人のために、minidiary-0.14cとしてminidiary-0.14との差分ファイルと、d3forumのブロック関数関連の追加ファイル、d3commentのAPI、xugj_blockも同梱して固めたファイルを、ここに置いておきます。 解凍後、夫々のフォルダにアップロードして使えます。

fileminidiary014c_diff.zip
(09/03/21 verc変更):コメント昇順/降順設定、最大表示数設定を反映。
d3forum0.85~
fileminidiary014b2_diff.zip
(08/09/22 ver-b2変更):
xoops2.0.16a-JPでの不具合対応のため、以前のバージョンからは全て上書き要
d3forum0.84以前
Page Top
ディレクトリ構造 anchor.png
  • 差分ファイルは、以下のディレクトリ構造です。
html (XOOPS_ROOT_PATH)
├─class
│    └smarty
│       └plugins
│               function.d3comment.php
│               function.d3forum_comment.php
│               function.d3forum_comment_postscount.php
│               function.d3forum_comment_topicscount.php
│               function.xugj_block.php
│
└─modules
    │ └(d3forum)
    │    └blocks
    │           blocks_bcomment.php
    │
    └─minidiary
         │      detail.php
         │      diarylist.php
         │      functions.php
         │      header.php
         │      index.php
         │      xoops_version.php
         │
         ├blocks
         │      b_diarylist.php
         │
         ├class
         │      minidiaryD3commentContent.class.php
         │
         ├language
         │ └japanese
         │      modinfo.php
         │
         └templates
            │   yd_detail.html
            │   yd_diarylist.html
            │   yd_index.html
            │   yd_rightarea.html
            │
            └blocks
                 b_diarylist.html
trust (XOOPS_TRUST_PATH)
└─modules
      └d3forum
         │     blocks_bcomment.php
         │
         └blocks
                 block_functions_bcomment.php
Page Top

xugj_blockの準備 anchor.png

 xugj_blockを使います。 上記差分パックを使うか、別途入手はこちら(PEEK XOOPS)、 → 「xoops_root_path/class/smarty/plugins/」内にファイル名「function.xugj_block.php」で保存します。
 解説はこちら(XFIELD TWCHNOTE)を参照いただければわかります。

Page Top

d3forumのブロック関連追加ファイル anchor.png

 日記への統合コメント一覧で日記執筆者へのコメントの絞込処理の実装のため、d3forumの差分ファイルをアップする必要があります。 d3forum本体のアップデートで上書きされないように、別ファイルとしてあります。 上記差分パックから忘れずにアップしてください。 なお、html側のmodules/(d3forum) ディレクトリ名は、実際のインストールディレクトリ名のところにアップします。
 

Page Top

D3commentクラス anchor.png

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

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

minidiary::minidiaryD3commentContent::

と記載します。
 なお、d3forumは0.83a以降のバージョンが必須で、D3commentの最新のAPIクラス群(差分パックにも同梱)を忘れずにアップして下さい。

Page Top

minidiaryソースの変更 anchor.png

 8つのソースファイルに手を入れます。(差分パックをご使用ください。)

 (09/03/21 ver-c)管理画面の設定項目が増えました。 以下のソース変更説明は、verb2以前のものです
 (08/09/22 ver-b2)xoops2.0.16a-JPで不具合があったので、phpファイルへの変更を見直しました。
 (08/09/07 ver-b1)コメント統合標準のテンプレート変数に書き換えました。

Page Top

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

 続いて、テンプレートを5つ、Altsysなどで編集します。
 (08/09/07 ver-b1)コメント統合標準のテンプレート変数に書き換えました。 以前のバージョンをお使いの方も、お手数ですがテンプレートの書き換えを行ってください。  ;-)

 

Page Top
b_diarylist.html anchor.png

 「b_diarylist.html」の、30~49行目 を編集します。

Everything is expanded.Everything is shortened.
29
30
31
32
33
34
35
36
37
38
39
40
 
 
 
 
 
 
 
 
 
 
 
 
    <tr><td colspan=2><{$block[num2].diary}>
    <{if $block[num2].com_num > 0}>
    <br />
    <a href="<{$xoops_url}>/modules/minidiary/detail.php?bid=<{$block[num2].bid}>#viewcomment">
    <img src="<{$xoops_url}>/modules/minidiary/images/comments.png" border=0 style="vertical-align:middle;" title="コメントあり" alt="コメントあり" /> <{$block[num2].com_num}></a>
        <{if $block[num2].newcom > 0}>
            <img src="<{$xoops_url}>/modules/minidiary/images/new.gif" border=0 style="vertical-align:middle;" title="new" alt="new" />
            [<{$block[num2].newcom_y}>年<{$block[num2].newcom_m}>月<{$block[num2].newcom_d}>日 <{$block[num2].newcom_h}>:<{$block[num2].newcom_i}>]
        <{/if}>
    &nbsp;&nbsp;
    <{/if}>
    </td></tr>

 ↓ 以下のように変更。

Everything is expanded.Everything is shortened.
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
    <tr><td colspan=2><{$block[num2].diary}>
   <{if $block.0.mod_config.comment_dirname}>
    <br />
     <{d3comment mode="count" var="comcount" mydirname='minidiary' id=$block[num2].bid class="minidiaryD3commentContent"}>
     <{if $comcount}>
         <a href="<{$xoops_url}>/modules/minidiary/detail.php?bid=<{$block[num2].bid}>#comment" title="コメントあり">
         <img src="<{$xoops_url}>/modules/minidiary/images/comments.png" border=0 style="vertical-align:middle;" title="コメントあり" alt="コメントあり" /> (<{$comcount}>)</a>
     <{/if}>
   <{else}>
    <{if $block[num2].com_num > 0}>
    <br />
    <a href="<{$xoops_url}>/modules/minidiary/detail.php?bid=<{$block[num2].bid}>#viewcomment">
    <img src="<{$xoops_url}>/modules/minidiary/images/comments.png" border=0 style="vertical-align:middle;" title="コメントあり" alt="コメントあり" /> <{$block[num2].com_num}></a>
        <{if $block[num2].newcom > 0}>
            <img src="<{$xoops_url}>/modules/minidiary/images/new.gif" border=0 style="vertical-align:middle;" title="new" alt="new" />
            [<{$block[num2].newcom_y}>年<{$block[num2].newcom_m}>月<{$block[num2].newcom_d}>日 <{$block[num2].newcom_h}>:<{$block[num2].newcom_i}>]
        <{/if}>
    &nbsp;&nbsp;
    <{/if}>
   <{/if}>
    </td></tr>
Page Top
yd_detail.html anchor.png

 「yd_detail.html」の、82~124行目 を編集します。

Everything is expanded.Everything is shortened.
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
<{if $yd_use_simplecomment == 0}>
<{$commentsnav}>
<center><{$lang_notice}></center>
<{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}>
 
<{else}>
 
<!-- start comment area -->
<{if $comments.0.id >0}>
<a name="viewcomment"></a>
<table class="outer"><tr><th>
コメント
</th></tr><tr><td>
<div style="margin: 1px; padding: 1px;">
<!-- start comments loop -->
<{include file="db:system_comments_flat.html"}>
<!-- end comments loop -->
</div>
</td></tr></table>
<br />
<{/if}>
<!-- start comment form -->
<table class="outer"><tr><th>
コメントを書く
</th></tr><tr><td>
<{if $xoops_isuser==1}>
<{$yr_comment_form}>
<{else}>
コメントを書くには<a href="<{$xoops_url}>/user.php">ログイン</a>が必要です。<br />
<{/if}>
</td></tr></table>
<!-- end comment form -->
<!-- end comment area -->
 
<{/if}>

 ↓ 以下のように変更。

Everything is expanded.Everything is shortened.
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
<!-- start comment area -->
<a name="viewcomment"></a>
<{if $mod_config.comment_dirname}>
    <{d3comment mydirname='minidiary' id=$yd_data.bid subject=$yd_data.title class="minidiaryD3commentContent"}>
<{else}>
  <{if $yd_use_simplecomment == 0}>
    <{$commentsnav}>
    <center><{$lang_notice}></center>
    <{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}>
 
  <{else}>
    <{if $comments.0.id >0}>
    <table class="outer"><tr><th>
    コメント
    </th></tr><tr><td>
    <div style="margin: 1px; padding: 1px;">
    <!-- start comments loop -->
    <{include file="db:system_comments_flat.html"}>
    <!-- end comments loop -->
    </div>
    </td></tr></table>
    <br />
    <{/if}>
    <!-- start comment form -->
    <table class="outer"><tr><th>
    コメントを書く
    </th></tr><tr><td>
    <{if $xoops_isuser==1}>
    <{$yr_comment_form}>
    <{else}>
    コメントを書くには<a href="<{$xoops_url}>/user.php">ログイン</a>が必要です。<br />
    <{/if}>
    </td></tr></table>
    <!-- end comment form -->
    <!-- end comment area -->
  <{/if}>
Page Top
yd_diarylist.html anchor.png

 「yd_diarylist.html」の、56~66行目 を編集します。

Everything is expanded.Everything is shortened.
55
56
57
58
59
60
61
62
63
64
65
66
 
 
 
 
 
 
 
 
 
 
 
 
    <tr><td colspan=2><{$yd_data[num2].diary}>
    <{if $yd_data[num2].com_num > 0}>
    <br />
    <a href="<{$xoops_url}>/modules/minidiary/detail.php?bid=<{$yd_data[num2].bid}>#viewcomment">
    <img src="images/comments.png" border=0 style="vertical-align:middle;" title="コメントあり" alt="コメントあり" /> <{$yd_data[num2].com_num}></a>
        <{if $yd_data[num2].newcom > 0}>
            <img src="images/new.gif" border=0 style="vertical-align:middle;" title="new" alt="new" />
            [<{$yd_data[num2].newcom_y}>年<{$yd_data[num2].newcom_m}>月<{$yd_data[num2].newcom_d}>日 <{$yd_data[num2].newcom_h}>:<{$yd_data[num2].newcom_i}>]
        <{/if}>
    &nbsp;&nbsp;
    <{/if}>
    </td></tr>

 ↓ 以下のように変更。

Everything is expanded.Everything is shortened.
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
    <tr><td colspan=2><{$yd_data[num2].diary}>
 
  <{if $mod_config.comment_dirname}>
    <{d3comment mode="count" var="comcount" mydirname='minidiary' id=$yd_data[num2].bid class="minidiaryD3commentContent"}>
     <{if $comcount}>
         <a href="<{$xoops_url}>/modules/minidiary/detail.php?bid=<{$yd_data[num2].bid}>#comment" title="コメントあり">
         <img src="images/comments.png" border=0 style="vertical-align:middle;" title="コメントあり" alt="コメントあり" /> (<{$comcount}>)</a>
     <{/if}>
  <{else}>
    <{if $yd_data[num2].com_num > 0}>
    <br />
    <a href="<{$xoops_url}>/modules/minidiary/detail.php?bid=<{$yd_data[num2].bid}>#viewcomment">
    <img src="images/comments.png" border=0 style="vertical-align:middle;" title="コメントあり" alt="コメントあり" /> <{$yd_data[num2].com_num}></a>
        <{if $yd_data[num2].newcom > 0}>
            <img src="images/new.gif" border=0 style="vertical-align:middle;" title="new" alt="new" />
            [<{$yd_data[num2].newcom_y}>年<{$yd_data[num2].newcom_m}>月<{$yd_data[num2].newcom_d}>日 <{$yd_data[num2].newcom_h}>:<{$yd_data[num2].newcom_i}>]
        <{/if}>
    &nbsp;&nbsp;
    <{/if}>
 
  <{/if}>
    </td></tr>
Page Top
yd_index.html anchor.png

 「yd_index.html」の、60~64行目 を編集します。

Everything is expanded.Everything is shortened.
59
60
61
62
63
64
65
 
 
 
 
 
 
 
<td style="border:1px gray solid;border-bottom:2px gray solid;text-align:right;">
<a href="<{$xoops_url}>/modules/minidiary/detail.php?bid=<{$yd_data[num].bid}>#viewcomment">
コメント(<{$yd_data[num].comment_num}>)
</a> | 
<a href="<{$xoops_url}>/modules/minidiary/detail.php?bid=<{$yd_data[num].bid}>">
続きを読む</a> 
<{if $yd_editperm==1}>

 ↓ 以下のように変更。

Everything is expanded.Everything is shortened.
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
<td style="border:1px gray solid;border-bottom:2px gray solid;text-align:right;">
 
<{if $mod_config.comment_dirname}>
 <{d3comment mode="count" var="comcount" mydirname='minidiary' id=$yd_data[num].bid class="minidiaryD3commentContent"}>
     <{if $comcount}>
         <a href="<{$xoops_url}>/modules/minidiary/detail.php?bid=<{$yd_data[num].bid}>#comment" title="コメント">コメント (<{$comcount}>)</a>
     <{else}>コメント (0)
     <{/if}>
<{else}>
 <a href="<{$xoops_url}>/modules/minidiary/detail.php?bid=<{$yd_data[num].bid}>#viewcomment">
コメント <{$yd_data[num].comment_num}>
 </a> 
<{/if}>
 | 
<a href="<{$xoops_url}>/modules/minidiary/detail.php?bid=<{$yd_data[num].bid}>">
続きを読む</a> 
<{if $yd_editperm==1}>
Page Top
yd_rightarea.html anchor.png

 「yd_rightarea.html」の、50~57行目 を編集します。

Everything is expanded.Everything is shortened.
49
50
51
52
53
54
55
56
57
58
59
 
 
 
 
 
 
 
 
 
 
 
<th>最近のコメント</th></tr>
<{section name=num loop=$yd_comment max=3}>
<tr>
<td><img src="<{$xoops_url}>/modules/minidiary/images/enum1.png" border=0 /><a href="<{$xoops_url}>/modules/minidiary/detail.php?bid=<{$yd_comment[num].bid}>#viewcomment"><{$yd_comment[num].title}></a> <{$yd_comment[num].uname}>[<{$yd_comment[num].month}>/<{$yd_comment[num].day}> <{$yd_comment[num].time}>]</td>
</tr>
<{/section}>
<tr>
<td style="border-top:1px gray solid;text-align:right;">
<img src="<{$xoops_url}>/modules/minidiary/images/arrow1.png" border=0 style="vertical-align:middle;" /> <a href="<{$xoops_url}>/modules/minidiary/viewcomment.php?req_uid=<{$yd_uid}>">コメント一覧へ</a></td>
</tr>
</table>

 ↓ 以下のように変更。

Everything is expanded.Everything is shortened.
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
<th>最近のコメント</th></tr>
<tr><td>
 
<{if $mod_config.comment_dirname}>
    <{xugj_block file=modules/`$mod_config.comment_dirname`/blocks/blocks_bcomment.php func="b_d3forum_list_posts_show" opt="`$mod_config.comment_dirname`,10,time,,,`$mod_config.comment_forum_id`,`$yd_uid`,yd_diary" item="block"}>
    <{section name=num max=3}>
    <ol style="padding:3px;margin:0;">
    <{foreach item=post from=$block.posts}>
      <li style="margin:1px;"><a href="<{$block.mod_url}>/index.php?post_id=<{$post.id}>"><{$post.subject}></a> <{$post.uname}> <{$post.post_time_formatted}></li>
    <{/foreach}>
    </ol>
    <{/section}>
    <img src="<{$xoops_url}>/modules/minidiary/images/arrow1.png" border=0 style="vertical-align:middle;" /> <a href="<{$block.mod_url}>/index.php?forum_id=17">コメント一覧へ</a></td>
<{else}>
    <{section name=num loop=$yd_comment max=3}>
    <tr>
    <td><img src="<{$xoops_url}>/modules/minidiary/images/enum1.png" border=0 /><a href="<{$xoops_url}>/modules/minidiary/detail.php?bid=<{$yd_comment[num].bid}>#comment"><{$yd_comment[num].title}></a> <{$yd_comment[num].uname}>[<{$yd_comment[num].month}>/<{$yd_comment[num].day}> <{$yd_comment[num].time}>]</td>
    </tr>
    <{/section}>
    <tr>
    <td style="border-top:1px gray solid;text-align:right;">
    <img src="<{$xoops_url}>/modules/minidiary/images/arrow1.png" border=0 style="vertical-align:middle;" /> <a href="<{$xoops_url}>/modules/minidiary/viewcomment.php?req_uid=<{$yd_uid}>">コメント一覧へ</a></td>
<{/if}>
</tr>
</table>
Page Top

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

 モバイルテンプハウスで、作成・公開済。 ver0.14b1への対応のため、モバイル用テンプレートもアップグレードが必要です。

Page Top

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

 xoops管理画面の「モジュールの管理」で、「minidiary」をモジュールアップデートします。 これで、「minidiary」の管理画面に、2つの項目 3つの項目 (08/09/07:フラット表示/スレッド表示切替を追加)が追加されます。

yd_confiig2.gif

ここで、

  1. コメント統合するd3forumのdirname : d3forumのコメント統合機能を使用する場合はd3forumのhtml側ディレクトリ名を指定します。xoopsコメントを使用する場合やコメント機能を無効にする場合は空欄です。
  2. コメント統合するフォーラムの番号 : コメント統合を選択した場合、統合先のforum_id値を必ず指定してください。
  3. コメント統合の表示方法 : フラット表示かスレッド表示かを選択します。

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

Page Top

その他 anchor.png

Page Top

ライセンス anchor.png

  • minidiaryソース、d3forumソース、xugj_blockソース:GPL
  • アイコン画像について
    minidiaryモジュールでは以下のサイトのアイコンや画像ファイルを利用しています。

famfamfam.com: Silk Icons
http://www.famfamfam.com/lab/icons/silk/


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