2: 2009-05-11 (月) 18:18:25 なーお  |
現: 2019-08-17 (土) 07:11:56 なーお  |
| | | |
| - 元ネタ:[[XUGJのこのトピ:http://www.xugj.org/modules/QandA/index.php?topic_id=1377]] | | - 元ネタ:[[XUGJのこのトピ:http://www.xugj.org/modules/QandA/index.php?topic_id=1377]] |
- | - 実装例1: このサイトのなーおn研究室の、右側にコメントトピック一覧があります。 | + | - 実装例1: このサイトのなーおn研究室の、右側にコメントトピック一覧、ブログの左側のコメントトピック一覧があります。デフォルトテンプレートの編集でやってます。 |
| - 実装例2: テストサイトの[[このページ:http://www.mc8.jp/HD3/modules/pico/]]の右側に、コメントトピック一覧と投稿一覧があります。&br; | | - 実装例2: テストサイトの[[このページ:http://www.mc8.jp/HD3/modules/pico/]]の右側に、コメントトピック一覧と投稿一覧があります。&br; |
| | | |
| *** 1.1. function b_d3forum_list_topics_show [#z63c35da] | | *** 1.1. function b_d3forum_list_topics_show [#z63c35da] |
| | | |
- | 内の191~195行目付近を、以下のように変更 | + | 内の191~195行目付近を、以下のように変更。 |
| + | _d3forum_topics テーブルから フィールド値「topic_external_link_id」を抽出し、アサインします。 |
| #code(php,191-){{ | | #code(php,191-){{ |
| if( $uid > 0 && $is_markup ) { | | if( $uid > 0 && $is_markup ) { |
| また、コメント元記事でのコメントはpost一覧表示を前提にしています。 トピック表示の場合は省略します。 | | また、コメント元記事でのコメントはpost一覧表示を前提にしています。 トピック表示の場合は省略します。 |
| なお、複数のモジュールに対応するためには、テンプレート内で | | なお、複数のモジュールに対応するためには、テンプレート内で |
- | <{if $post.forum_id == 1}> や、 <{if $topic.forum_id == 1}> | + | <{if $post.forum_id == 1}> や |
- | などの方法で場合分けし、リンク先を切り替える必要があります。 | + | <{if $topic.forum_id == 1}> |
| + | などの方法で場合分けし、リンク先を切り替える必要があります。 逆に言えば、きちんと場合分けを記載しさえすれば、カスタムテンプレートである必要はなく、d3forumの各デフォルトテンプレート本体を編集しても構いません。 |
| | | |
| *** 2.1. _custom_d3f_topics.html [#db00490a] | | *** 2.1. _custom_d3f_topics.html [#db00490a] |
| <{/if}> | | <{/if}> |
| }} | | }} |
| + | |
| + | なお、デフォルトテンプレート「(d3forum)_block_list_topics.html」を編集して使用する場合は、 |
| + | #code(html,16-){{ |
| + | <td> |
| + | <{if $topic.forum_id == 4}> |
| + | <a href="<{$xoops_url}>/modules/pico/index.php?content_id=<{$topic.external_link_id}>#post_id<{$topic.last_post_id}>"> |
| + | <{elseif $topic.forum_id == 2}> |
| + | <a href="<{$xoops_url}>/modules/d3blog/details.php?bid=<{$topic.external_link_id}>#post_id<{$topic.last_post_id}>"> |
| + | <{else}> |
| + | <a href="<{$block.mod_url}>/index.php?topic_id=<{$topic.id}>#post_id<{$topic.last_post_id}>"> |
| + | <{/if}> |
| + | }} |
| + | |
| + | #code(html,62-){{ |
| + | <li> |
| + | <{if $topic.forum_id == 4}> |
| + | <a href="<{$xoops_url}>/modules/pico/index.php?content_id=<{$topic.external_link_id}>#post_id<{$topic.last_post_id}>"> |
| + | <{elseif $topic.forum_id == 2}> |
| + | <a href="<{$xoops_url}>/modules/d3blog/details.php?bid=<{$topic.external_link_id}>#post_id<{$topic.last_post_id}>"> |
| + | <{else}> |
| + | <a href="<{$block.mod_url}>/index.php?topic_id=<{$topic.id}>#post_id<{$topic.last_post_id}>"> |
| + | <{/if}> |
| + | <{$topic.title}></a>(<{$topic.replies}>) <{$topic.last_uname}> <{$topic.last_post_time_formatted}></li> |
| + | }} |
| + | |
| + | などとして判別分岐すればOKです。上記の例は、picoとd3blogのリンク先を変更する場合です。$topic.forum_idの部分と、リンク先はサイト毎に適宜設定が必要です。 |
| | | |
| *** 2.2. _custom_d3f_posts.html [#e6d73320] | | *** 2.2. _custom_d3f_posts.html [#e6d73320] |
| </ol> | | </ol> |
| }} | | }} |
| + | |
| + | なお、デフォルトテンプレート「(d3forum)_block_list_posts.html」を編集して使用する場合は、 |
| + | #code(html,3-){{ |
| + | <li style="margin:1px;"> |
| + | <{if $post.forum_id == 4}> |
| + | <a href="<{$xoops_url}>/modules/pico/index.php?content_id=<{$post.external_link_id}>#post_id<{$post.id}>"> |
| + | <{elseif $post.forum_id == 2}> |
| + | <a href="<{$xoops_url}>/modules/d3blog/details.php?bid=<{$post.external_link_id}>#post_id<{$post.id}>"> |
| + | <{else}> |
| + | <li style="margin:1px;"><a href="<{$block.mod_url}>/index.php?post_id=<{$post.id}>"> |
| + | <{/if}> |
| + | <{$post.subject}></a> <{$post.uname}> <{$post.post_time_formatted}></li> |
| + | }} |
| + | |
| + | などとして判別分岐すればOKです。上記の例は、picoとd3blogのリンク先を変更する場合です。$topic.forum_idの部分と、リンク先はサイト毎に適宜設定が必要です。 |
| | | |
| ** 3. d3forumブロックの複製 [#hb23e68a] | | ** 3. d3forumブロックの複製 [#hb23e68a] |
| | | |
| *** 3.1. トピック一覧 ブロック [#h58d7c0e] | | *** 3.1. トピック一覧 ブロック [#h58d7c0e] |
- | - ブロックオプションの「このブロックのテンプレート」には、 「db:_custom_d3f_topics.html」 と記載します。 | + | - カスタムテンプレートを使用する場合は、ブロックオプションの「このブロックのテンプレート」には、 「db:_custom_d3f_topics.html」 に変更します。 |
| - 「フォーラムを指定する」 欄には、コメント統合したフォーラムを指定します。 | | - 「フォーラムを指定する」 欄には、コメント統合したフォーラムを指定します。 |
| - 表示件数、その他オプションを指定します。 | | - 表示件数、その他オプションを指定します。 |
| | | |
| *** 3.2. 投稿一覧 ブロック [#y9593886] | | *** 3.2. 投稿一覧 ブロック [#y9593886] |
- | - ブロックオプションの「このブロックのテンプレート」には、 「db:_custom_d3f_posts.html」 と記載します。 | + | - カスタムテンプレートを使用する場合は、ブロックオプションの「このブロックのテンプレート」には、 「db:_custom_d3f_posts.html」 に変更します。 |
| - 「フォーラムを指定する」 欄には、コメント統合したフォーラムを指定します。 | | - 「フォーラムを指定する」 欄には、コメント統合したフォーラムを指定します。 |
| - 表示件数、その他オプションを指定します。 | | - 表示件数、その他オプションを指定します。 |