ページへ戻る
印刷
inc/d3forum/d3f_com_alt
をテンプレートにして作成 ::
なーおんWEB
xpwiki
:inc/d3forum/d3f_com_alt をテンプレートにして作成
開始行:
* d3forumコメント統合でブロックから元記事へリンクしたい
- 元ネタ:[[XUGJのこのトピ:http://www.xugj.org/modules/Qa...
- 実装例1: このサイトのなーおn研究室の、右側にコメント...
- 実装例2: テストサイトの[[このページ:http://www.mc8.j...
** 1. d3forumソースハック
(trust_path)/modules/d3forum/blocks/block_functions.php ...
*** 1.1. function b_d3forum_list_topics_show
内の191~195行目付近を、以下のように変更。
_d3forum_topics テーブルから フィールド値「topic_exte...
#code(php,191-){{
if( $uid > 0 && $is_markup ) {
$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_...
} else {
$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_...
}
}}
同じく、224~243行目付近、以下の1行を追記
#code(php,224-){{
$topic4assign = array(
'id' => intval( $topic_row['topic_id'] ) ,
'title' => $myts->makeTboxData4Show( $topic_row['topic...
'forum_id' => intval( $topic_row['forum_id'] ) ,
'forum_title' => $myts->makeTboxData4Show( $topic_row[...
'replies' => $topic_row['topic_posts_count'] - 1 ,
'views' => intval( $topic_row['topic_views'] ) ,
'votes_count' => $topic_row['topic_votes_count'] ,
'votes_sum' => intval( $topic_row['topic_votes_sum'] ) ,
'last_post_id' => intval( $topic_row['topic_last_post_...
'last_post_time' => intval( $topic_row['topic_last_pos...
'last_post_time_formatted' => formatTimestamp($topic_r...
'last_uid' => intval( $topic_row['topic_last_uid'] ) ,
'last_uname' => XoopsUser::getUnameFromId( $topic_row[...
'solved' => intval( $topic_row['topic_solved'] ) ,
'u2t_marked' => intval( $topic_row['u2t_marked'] ) ,
'external_link_id' => intval( $topic_row['topic_extern...
) ;
}}
*** 1.2. function b_d3forum_list_posts_show
内の392行目付近
#code(php,392){{
$sql = "SELECT p.post_id, p.subject, p.votes_sum, p.vote...
}}
同じく421~433行目付近に1行追加
#code(php,421-){{
$post4assign = array(
'id' => intval( $post_row['post_id'] ) ,
'subject' => $myts->makeTboxData4Show( $post_row['subj...
'forum_id' => intval( $post_row['forum_id'] ) ,
'forum_title' => $myts->makeTboxData4Show( $post_row['...
'votes_count' => $post_row['votes_count'] ,
'votes_sum' => intval( $post_row['votes_sum'] ) ,
'post_time' => intval( $post_row['post_time'] ) ,
'post_time_formatted' => formatTimestamp( $post_row['p...
'uid' => intval( $post_row['uid'] ) ,
'uname' => XoopsUser::getUnameFromId( $post_row['uid']...
'external_link_id' => intval( $post_row['topic_externa...
) ;
}}
** 2. カスタムテンプレート作成(Altsys使用)
以下、picoへのリンクの例です。 ディレクトリ名や、他のモ...
また、コメント元記事でのコメントはpost一覧表示を前提にし...
なお、複数のモジュールに対応するためには、テンプレート内で
<{if $post.forum_id == 1}> や
<{if $topic.forum_id == 1}>
などの方法で場合分けし、リンク先を切り替える必要がありま...
*** 2.1. _custom_d3f_topics.html
「(d3forum)_block_list_topics.html」からコピーしてきて、1...
#code(html,1-){{
<{if $block.full_view == true}>
<table class="outer" cellspacing="1">
<thead>
<tr>
<th><{$block.lang_forum}></th>
<th><{$block.lang_topic}></th>
<th align="center"><{$block.lang_replies}></th>
<th align="center"><{$block.lang_views}></th>
<th align="center" colspan="2"><{$block.lang_lastpost}><...
</tr>
</thead>
<{foreach item=topic from=$block.topics}>
<{strip}>
<tr class="<{cycle values="even,odd"}>">
<td><a href="<{$block.mod_url}>/index.php?forum_id=<{$to...
<td><a href="<{$xoops_url}>/modules/pico/index.php?conte...
<{if $topic.u2t_marked}><img src="<{$block.mod_imageurl}...
<{* displays the last post's subject or topic title *}>
<{if $block.disp_last_subject }>
<{$topic.last_subject}>
<{else}>
<{$topic.title}>
<{/if}></a>
<{if ! $topic.solved}><img src="<{$block.mod_imageurl}>/...
<td align="center"><{$topic.replies}></td>
<td align="center"><{$topic.views}></td>
<td align="center" nowrap="nowrap"><{$topic.last_uname}>...
<td align="right" nowrap="nowrap"><{$topic.last_post_tim...
</tr>
<{/strip}>
<{/foreach}>
</table>
<div style="text-align:right; padding: 5px;">
<a href="<{$block.mod_url}>/index.php?page=search"><{$blo...
<{if is_numeric( $block.forums ) }>
<a href="<{$block.mod_url}>/index.php?forum_id=<{$block.f...
<{else}>
<a href="<{$block.mod_url}>/index.php?cat_ids=<{$block.ca...
<{/if}>
<{if is_numeric( $block.categories ) }>
<a href="<{$block.mod_url}>/index.php?cat_id=<{$block.cat...
<{/if}>
<a href="<{$block.mod_url}>/index.php"><{$block.lang_link...
</div>
<{else}>
<ol style="padding:3px;margin:0;">
<{foreach item=topic from=$block.topics}>
<li><a href="<{$xoops_url}>/modules/pico/index.php?conte...
<{/foreach}>
</ol>
<{/if}>
}}
なお、デフォルトテンプレート「(d3forum)_block_list_topics...
#code(html,16-){{
<td>
<{if $topic.forum_id == 4}>
<a href="<{$xoops_url}>/modules/pico/index.php?content_...
<{elseif $topic.forum_id == 2}>
<a href="<{$xoops_url}>/modules/d3blog/details.php?bid=...
<{else}>
<a href="<{$block.mod_url}>/index.php?topic_id=<{$topic...
<{/if}>
}}
#code(html,62-){{
<li>
<{if $topic.forum_id == 4}>
<a href="<{$xoops_url}>/modules/pico/index.php?content_...
<{elseif $topic.forum_id == 2}>
<a href="<{$xoops_url}>/modules/d3blog/details.php?bid=...
<{else}>
<a href="<{$block.mod_url}>/index.php?topic_id=<{$topic...
<{/if}>
<{$topic.title}></a>(<{$topic.replies}>) <{$topic.last_u...
}}
などとして判別分岐すればOKです。上記の例は、picoとd3blo...
*** 2.2. _custom_d3f_posts.html
「(d3forum)_block_list_posts.html」からコピーしてきて、3...
#code(html,1-){{
<ol style="padding:3px;margin:0;">
<{foreach item=post from=$block.posts}>
<li style="margin:1px;"><a href="<{$xoops_url}>/modules/...
<{/foreach}>
</ol>
}}
なお、デフォルトテンプレート「(d3forum)_block_list_posts....
#code(html,3-){{
<li style="margin:1px;">
<{if $post.forum_id == 4}>
<a href="<{$xoops_url}>/modules/pico/index.php?content_...
<{elseif $post.forum_id == 2}>
<a href="<{$xoops_url}>/modules/d3blog/details.php?bid=...
<{else}>
<li style="margin:1px;"><a href="<{$block.mod_url}>/ind...
<{/if}>
<{$post.subject}></a> <{$post.uname}> <{$post.post_time_...
}}
などとして判別分岐すればOKです。上記の例は、picoとd3blo...
** 3. d3forumブロックの複製
Altsysで、d3forumのブロックを複製します。
なお、それぞれコメント統合元モジュールごとに、複製する必...
複数の統合コメントのフォーラムを一括指定して表示すること...
*** 3.1. トピック一覧 ブロック
- カスタムテンプレートを使用する場合は、ブロックオプショ...
- 「フォーラムを指定する」 欄には、コメント統合したフォ...
- 表示件数、その他オプションを指定します。
- タイトル、表示対象、優先度、などを適切に設定します。
*** 3.2. 投稿一覧 ブロック
- カスタムテンプレートを使用する場合は、ブロックオプショ...
- 「フォーラムを指定する」 欄には、コメント統合したフォ...
- 表示件数、その他オプションを指定します。
- タイトル、表示対象、優先度、などを適切に設定します。
** 4. d3forumのテンプレート変更
コメント一覧のリンクをクリックした時に、当該コメントにジ...
*** 4.1. d3forum_comment_listposts_flat.html
26行目付近。
<a href="<{$mod_url}>/index.php?post_id=<{$post.id}>" id...
これを、以下のように変更
<a href="<{$mod_url}>/index.php?post_id=<{$post.id}>" id...
終了行:
* d3forumコメント統合でブロックから元記事へリンクしたい
- 元ネタ:[[XUGJのこのトピ:http://www.xugj.org/modules/Qa...
- 実装例1: このサイトのなーおn研究室の、右側にコメント...
- 実装例2: テストサイトの[[このページ:http://www.mc8.j...
** 1. d3forumソースハック
(trust_path)/modules/d3forum/blocks/block_functions.php ...
*** 1.1. function b_d3forum_list_topics_show
内の191~195行目付近を、以下のように変更。
_d3forum_topics テーブルから フィールド値「topic_exte...
#code(php,191-){{
if( $uid > 0 && $is_markup ) {
$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_...
} else {
$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_...
}
}}
同じく、224~243行目付近、以下の1行を追記
#code(php,224-){{
$topic4assign = array(
'id' => intval( $topic_row['topic_id'] ) ,
'title' => $myts->makeTboxData4Show( $topic_row['topic...
'forum_id' => intval( $topic_row['forum_id'] ) ,
'forum_title' => $myts->makeTboxData4Show( $topic_row[...
'replies' => $topic_row['topic_posts_count'] - 1 ,
'views' => intval( $topic_row['topic_views'] ) ,
'votes_count' => $topic_row['topic_votes_count'] ,
'votes_sum' => intval( $topic_row['topic_votes_sum'] ) ,
'last_post_id' => intval( $topic_row['topic_last_post_...
'last_post_time' => intval( $topic_row['topic_last_pos...
'last_post_time_formatted' => formatTimestamp($topic_r...
'last_uid' => intval( $topic_row['topic_last_uid'] ) ,
'last_uname' => XoopsUser::getUnameFromId( $topic_row[...
'solved' => intval( $topic_row['topic_solved'] ) ,
'u2t_marked' => intval( $topic_row['u2t_marked'] ) ,
'external_link_id' => intval( $topic_row['topic_extern...
) ;
}}
*** 1.2. function b_d3forum_list_posts_show
内の392行目付近
#code(php,392){{
$sql = "SELECT p.post_id, p.subject, p.votes_sum, p.vote...
}}
同じく421~433行目付近に1行追加
#code(php,421-){{
$post4assign = array(
'id' => intval( $post_row['post_id'] ) ,
'subject' => $myts->makeTboxData4Show( $post_row['subj...
'forum_id' => intval( $post_row['forum_id'] ) ,
'forum_title' => $myts->makeTboxData4Show( $post_row['...
'votes_count' => $post_row['votes_count'] ,
'votes_sum' => intval( $post_row['votes_sum'] ) ,
'post_time' => intval( $post_row['post_time'] ) ,
'post_time_formatted' => formatTimestamp( $post_row['p...
'uid' => intval( $post_row['uid'] ) ,
'uname' => XoopsUser::getUnameFromId( $post_row['uid']...
'external_link_id' => intval( $post_row['topic_externa...
) ;
}}
** 2. カスタムテンプレート作成(Altsys使用)
以下、picoへのリンクの例です。 ディレクトリ名や、他のモ...
また、コメント元記事でのコメントはpost一覧表示を前提にし...
なお、複数のモジュールに対応するためには、テンプレート内で
<{if $post.forum_id == 1}> や
<{if $topic.forum_id == 1}>
などの方法で場合分けし、リンク先を切り替える必要がありま...
*** 2.1. _custom_d3f_topics.html
「(d3forum)_block_list_topics.html」からコピーしてきて、1...
#code(html,1-){{
<{if $block.full_view == true}>
<table class="outer" cellspacing="1">
<thead>
<tr>
<th><{$block.lang_forum}></th>
<th><{$block.lang_topic}></th>
<th align="center"><{$block.lang_replies}></th>
<th align="center"><{$block.lang_views}></th>
<th align="center" colspan="2"><{$block.lang_lastpost}><...
</tr>
</thead>
<{foreach item=topic from=$block.topics}>
<{strip}>
<tr class="<{cycle values="even,odd"}>">
<td><a href="<{$block.mod_url}>/index.php?forum_id=<{$to...
<td><a href="<{$xoops_url}>/modules/pico/index.php?conte...
<{if $topic.u2t_marked}><img src="<{$block.mod_imageurl}...
<{* displays the last post's subject or topic title *}>
<{if $block.disp_last_subject }>
<{$topic.last_subject}>
<{else}>
<{$topic.title}>
<{/if}></a>
<{if ! $topic.solved}><img src="<{$block.mod_imageurl}>/...
<td align="center"><{$topic.replies}></td>
<td align="center"><{$topic.views}></td>
<td align="center" nowrap="nowrap"><{$topic.last_uname}>...
<td align="right" nowrap="nowrap"><{$topic.last_post_tim...
</tr>
<{/strip}>
<{/foreach}>
</table>
<div style="text-align:right; padding: 5px;">
<a href="<{$block.mod_url}>/index.php?page=search"><{$blo...
<{if is_numeric( $block.forums ) }>
<a href="<{$block.mod_url}>/index.php?forum_id=<{$block.f...
<{else}>
<a href="<{$block.mod_url}>/index.php?cat_ids=<{$block.ca...
<{/if}>
<{if is_numeric( $block.categories ) }>
<a href="<{$block.mod_url}>/index.php?cat_id=<{$block.cat...
<{/if}>
<a href="<{$block.mod_url}>/index.php"><{$block.lang_link...
</div>
<{else}>
<ol style="padding:3px;margin:0;">
<{foreach item=topic from=$block.topics}>
<li><a href="<{$xoops_url}>/modules/pico/index.php?conte...
<{/foreach}>
</ol>
<{/if}>
}}
なお、デフォルトテンプレート「(d3forum)_block_list_topics...
#code(html,16-){{
<td>
<{if $topic.forum_id == 4}>
<a href="<{$xoops_url}>/modules/pico/index.php?content_...
<{elseif $topic.forum_id == 2}>
<a href="<{$xoops_url}>/modules/d3blog/details.php?bid=...
<{else}>
<a href="<{$block.mod_url}>/index.php?topic_id=<{$topic...
<{/if}>
}}
#code(html,62-){{
<li>
<{if $topic.forum_id == 4}>
<a href="<{$xoops_url}>/modules/pico/index.php?content_...
<{elseif $topic.forum_id == 2}>
<a href="<{$xoops_url}>/modules/d3blog/details.php?bid=...
<{else}>
<a href="<{$block.mod_url}>/index.php?topic_id=<{$topic...
<{/if}>
<{$topic.title}></a>(<{$topic.replies}>) <{$topic.last_u...
}}
などとして判別分岐すればOKです。上記の例は、picoとd3blo...
*** 2.2. _custom_d3f_posts.html
「(d3forum)_block_list_posts.html」からコピーしてきて、3...
#code(html,1-){{
<ol style="padding:3px;margin:0;">
<{foreach item=post from=$block.posts}>
<li style="margin:1px;"><a href="<{$xoops_url}>/modules/...
<{/foreach}>
</ol>
}}
なお、デフォルトテンプレート「(d3forum)_block_list_posts....
#code(html,3-){{
<li style="margin:1px;">
<{if $post.forum_id == 4}>
<a href="<{$xoops_url}>/modules/pico/index.php?content_...
<{elseif $post.forum_id == 2}>
<a href="<{$xoops_url}>/modules/d3blog/details.php?bid=...
<{else}>
<li style="margin:1px;"><a href="<{$block.mod_url}>/ind...
<{/if}>
<{$post.subject}></a> <{$post.uname}> <{$post.post_time_...
}}
などとして判別分岐すればOKです。上記の例は、picoとd3blo...
** 3. d3forumブロックの複製
Altsysで、d3forumのブロックを複製します。
なお、それぞれコメント統合元モジュールごとに、複製する必...
複数の統合コメントのフォーラムを一括指定して表示すること...
*** 3.1. トピック一覧 ブロック
- カスタムテンプレートを使用する場合は、ブロックオプショ...
- 「フォーラムを指定する」 欄には、コメント統合したフォ...
- 表示件数、その他オプションを指定します。
- タイトル、表示対象、優先度、などを適切に設定します。
*** 3.2. 投稿一覧 ブロック
- カスタムテンプレートを使用する場合は、ブロックオプショ...
- 「フォーラムを指定する」 欄には、コメント統合したフォ...
- 表示件数、その他オプションを指定します。
- タイトル、表示対象、優先度、などを適切に設定します。
** 4. d3forumのテンプレート変更
コメント一覧のリンクをクリックした時に、当該コメントにジ...
*** 4.1. d3forum_comment_listposts_flat.html
26行目付近。
<a href="<{$mod_url}>/index.php?post_id=<{$post.id}>" id...
これを、以下のように変更
<a href="<{$mod_url}>/index.php?post_id=<{$post.id}>" id...
ページ名: