なーお'nWEB
Theme
Auto
Light
Dark
|
新規
一覧
検索
最新
ヘルプ
ページへ戻る
複製
履歴
印刷
minidiaryモジュールで、d3コメント統合
のソース
xpwiki
:
inc
/
yd_d3com_b
のソース
差分
を表示
inc/yd_d3com_b
へ行く。
« Prev
*minidiaryモジュールで、d3コメント統合 [#eeaad7de] **概要 [#jc3cb7c7] 以前より、[[minidiaryモジュール:http://www.yamareco.com/weblog/xoops/]] をコメント統合で使いたいとは思っていましたが、D3コメントクラスを書く時間がようやく取れたので、minidiary-ver0.14をベースに手を入れてみました。 + D3コメントクラスです。 一応、こんな風に表示されます。 &ref(inc/yd_d3com/yd_d3com_class.gif,mw:200,mh:200); &font(Red){(08/09/07 ver-b1変更) 権限チェック~リダイレクトを組み込みました};。 参考にした記事は、[[こちら(XUGJ):http://www.xugj.org/modules/QandA/index.php?post_id=3714]] (ご注意:)d3forumの投稿一覧表示などには、タイトル・投稿者などが表示されますが、それをクリックしても本分要旨やコメントが表示されずにリダイレクトされます。&br;&br; + コメント統合先のd3forumディレクトリ名・フォーラムid値は、&font(Red){%%d3blog%% (08/09/07変更)d3pipes};のコメント統合を参考に、minidiaryの管理画面でmodule_configに保存する方式としました。 そして、コメント統合のクラスはd3forum-0.83a以降で実装された新方式(「d3comment」で呼ぶほう)を採用しています。 また、D3commentクラス内でforum_idまで認識するため、テンプレート内に記述する必要がありません。 こうすることで、複数サイトを共有化している場合でも、携帯用のテンプレートを共通化できますし、テンプレート配布の際にも神経を使わずに済みます。&br;&br; + コメント一覧ブロックは、xugj_blockで実装しています。([[参考記事:http://www.yamareco.com/weblog/2008/02/22/minidiary008yeyey/#comments]]:thx さやさんのコメント13) &font(Red){ (08/09/07 ver-b1変更) 「表示中の執筆者へのコメントを絞り込んで表示」を実装};しました。&br; &br; **手順と方法 [#cc60f300] テンプレートだけでなく、ソースの変更も必要ですので、細かく記しておきます。 なお、個別のアップロードも編集も面倒、という人のために、minidiary-0.14cとしてminidiary-0.14との差分ファイルと、d3forumのブロック関数関連の追加ファイル、d3commentのAPI、xugj_blockも同梱して固めたファイルを、ここに置いておきます。 解凍後、夫々のフォルダにアップロードして使えます。 |&ref(minidiary014c_diff.zip);&br;(09/03/21 verc変更):コメント昇順/降順設定、最大表示数設定を反映。|d3forum0.85~| |&ref(minidiary014b2_diff.zip);&br; &font(Red){(08/09/22 ver-b2変更):&br;xoops2.0.16a-JPでの不具合対応のため、以前のバージョンからは全て上書き要};。|d3forum0.84以前| ****ディレクトリ構造 [#wdb92a83] -差分ファイルは、以下のディレクトリ構造です。 #code(pre,nonumber){{ 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 }} #code(pre,nonumber){{ trust (XOOPS_TRUST_PATH) └─modules └d3forum │ blocks_bcomment.php │ └blocks block_functions_bcomment.php }} ***xugj_blockの準備 [#ad1951ab] xugj_blockを使います。 上記差分パックを使うか、別途入手は[[こちら:http://xoops.peak.ne.jp/modules/news/index.php?page=article&storyid=416]](PEEK XOOPS)、 → 「xoops_root_path/class/smarty/plugins/」内にファイル名「function.xugj_block.php」で保存します。 解説は[[こちら:http://xfield.info/modules/tautech/content0192.html]](XFIELD TWCHNOTE)を参照いただければわかります。&br; ***d3forumのブロック関連追加ファイル [#xb32af7d] 日記への統合コメント一覧で日記執筆者へのコメントの絞込処理の実装のため、d3forumの差分ファイルをアップする必要があります。 d3forum本体のアップデートで上書きされないように、別ファイルとしてあります。 上記差分パックから忘れずにアップしてください。 なお、html側のmodules/(d3forum) ディレクトリ名は、実際のインストールディレクトリ名のところにアップします。 ***D3commentクラス [#w8be5a6b] D3commentクラスは、上記差分ファイルからか下記ファイルをダウンロード後、「minidiary/class」内にアップロードして使用します。 |&ref(minidiaryD3commentContent.class.php);| 当然ながら、d3forumの方にコメント統合用に掲示板を追加し、(必要があれば)過去のxoopsコメントをインポート後、「コメント統合時の参照方法」に minidiary::minidiaryD3commentContent:: と記載します。 なお、&font(Red){d3forumは0.83a以降のバージョンが必須};で、D3commentの最新のAPIクラス群(差分パックにも同梱)を忘れずにアップして下さい。 ***minidiaryソースの変更 [#h85cabf0] 8つのソースファイルに手を入れます。(差分パックをご使用ください。) &br; &font(Red){(09/03/21 ver-c)};管理画面の設定項目が増えました。 &font(Red){以下のソース変更説明は、verb2以前のものです};。 &font(Red){(08/09/22 ver-b2)};xoops2.0.16a-JPで不具合があったので、phpファイルへの変更を見直しました。 &font(Red){(08/09/07 ver-b1)};コメント統合標準のテンプレート変数に書き換えました。 &br; ***テンプレートの編集 [#h52b6982] 続いて、テンプレートを5つ、Altsysなどで編集します。 &font(Red){(08/09/07 ver-b1)};コメント統合標準のテンプレート変数に書き換えました。 &font(Red){以前のバージョンをお使いの方も、お手数ですがテンプレートの書き換えを行ってください};。 ;-) &br; **** b_diarylist.html [#a1ed9572] 「b_diarylist.html」の、30~49行目 を編集します。 #code(html,29-){{ <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}> <{/if}> </td></tr> }} ↓ 以下のように変更。 #code(html,29-){{ <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}> <{/if}> <{/if}> </td></tr> }} ****yd_detail.html [#cca33336] 「yd_detail.html」の、82~124行目 を編集します。 #code(html,81-){{ <{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}> }} ↓ 以下のように変更。 #code(html,81-){{ <!-- 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}> }} ****yd_diarylist.html [#p0e5f3dc] 「yd_diarylist.html」の、56~66行目 を編集します。 #code(html,55-){{ <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}> <{/if}> </td></tr> }} ↓ 以下のように変更。 #code(html,55-){{ <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}> <{/if}> <{/if}> </td></tr> }} ****yd_index.html [#rfa3958a] 「yd_index.html」の、60~64行目 を編集します。 #code(html,59-){{ <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}> }} ↓ 以下のように変更。 #code(html,59-){{ <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}> }} ****yd_rightarea.html [#p79265f5] 「yd_rightarea.html」の、50~57行目 を編集します。 #code(html,49-){{ <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> }} ↓ 以下のように変更。 #code(html,49-){{ <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> }} ***モバイル用テンプレート [#hf57673f] モバイルテンプハウスで、[[作成・公開済:http://www.mc8.jp/HD/modules/xpwiki?Templates/minidiary]]。 &font(Red){ver0.14b1への対応のため、モバイル用テンプレートもアップグレードが必要};です。 **インストールと設定 [#i828df20] xoops管理画面の「モジュールの管理」で、''&font(Maroon){「minidiary」をモジュールアップデート};''します。 これで、「minidiary」の管理画面に、%%2つの項目%% 3つの項目 (08/09/07:フラット表示/スレッド表示切替を追加)が追加されます。 &ref(yd_confiig2.gif,mw:200,mh:200); ここで、 +コメント統合するd3forumのdirname : d3forumのコメント統合機能を使用する場合はd3forumのhtml側ディレクトリ名を指定します。xoopsコメントを使用する場合やコメント機能を無効にする場合は空欄です。 +コメント統合するフォーラムの番号 : コメント統合を選択した場合、統合先のforum_id値を必ず指定してください。 +コメント統合の表示方法 : フラット表示かスレッド表示かを選択します。 これらを設定すれば完了です。(この編集を行うまでは、xoopsコメントシステムが有効です。) **その他 [#add4bb35] ***関連情報 [#y79a621e] - [[minidiary+D3コメント統合へのお知恵を:http://www.xugj.org/modules/d3forum/index.php?topic_id=757#post_id4643]] (XUGJ) - [[D3comment統合と、コメント元のイベント通知:http://www.xugj.org/modules/QandA/index.php?post_id=4875]] (XUGJ) - [[d3forumコメント統合で、元記事の閲覧権限に連動したい:http://www.xugj.org/modules/QandA/index.php?topic_id=560]] (XUGJ) ***ライセンス [#l166de51] -minidiaryソース、d3forumソース、xugj_blockソース:GPL -アイコン画像について minidiaryモジュールでは以下のサイトのアイコンや画像ファイルを利用しています。 famfamfam.com: Silk Icons http://www.famfamfam.com/lab/icons/silk/ -> [[Creative Commons Attribution 2.5 License:http://creativecommons.org/licenses/by/2.5/]]
« Prev
inc/yd_d3com_b のバックアップソース(No. All)
現: 2026-08-13 (木) 08:56:06
なーお
ぺージ情報
ぺージ名 :
inc/yd_d3com_b
ページ別名 :
未設定
ページ作成 :
なーお
閲覧可
グループ :
すべての訪問者
ユーザー :
すべての訪問者
編集可
グループ :
なし
ユーザー :
なし
Counter: 39, today: 1, yesterday: 0