E-mail
パスワード
次回から自動ログインする
パスワード紛失
新規登録
ホーム
|
新着情報
|
研究室
|
掲示板
|
ぶろぐ
|
Wiki
|
お問合せ
|
サイトマップ
|
|
新規
一覧
検索
最新
ヘルプ
ページへ戻る
複製
履歴
印刷
inc/d3forum/d3com_tree
のソース
xpwiki
:
inc
/
d3forum
/
d3com_tree
のソース
差分
を表示
inc/d3forum/d3com_tree
へ行く。
« Prev
* コメント統合で d3forumのツリー全表示 [#xd65ae5b] [[元ネタ:http://www.xugj.org/modules/QandA/index.php?topic_id=1310]] - XUGJ 上の内容から以下の機能を追加しました。 + 「投稿の新しいものから」「投稿の古いものから」をクリックした時の、ツリー表示の降順/昇順切り替え。%%(「ツリー構造順」は追いきれなかったので反映できていません。)%%(「ツリー構造順」も反映しました。) + 表示中のツリーを判別するためのインジケータ (テンプレート側で編集) ++ ツリー(トピック)が2つ以上の場合のみ表示するように変更しました。 + 当該元記事についた全コメントをツリー表示するか、そのトピだけツリー表示として他のトピックはトピックリスト表示とするか、テンプレートの編集のみで対応できます。 まだまだ未熟ですが、現状でよろしければどうぞお試しください。 実装済みのサイト(参考まで) : [[モバイルテンプハウス:http://www.mc8.jp/HD/modules/d3forum/index.php?topic_id=31]] ** 背景 [#wcafe816] コメント統合で付いたコメント。 質問内容が変わったりしてトピック分けしたりすると、d3forum側で「このトピックの投稿一覧へ」で閲覧してもトピック内の投稿しか表示されないため、同じ元記事に紐付いた他のトピックの投稿に気づかない場合があります。 オリジナル版では、元記事にジャンプして初めてその存在に気づくことになっていて、最大表示記事数を超えている場合は元記事側でも他のトピの投稿が流れてしまって表示されない場合もあります。 こういう時は、仕方なく「トピック表示」にしたりしますが、訪問者から見るとコメントし辛い感じ。 色々な案を考えてやってみたのですが、一番しっくりきたのはd3forum側で「このトピックの投稿一覧へ」を表示したときに、他のトピも含めてツリーを表示するというものです。 当該トピだけでしたら、テンプレート編集だけで行けますが、全トピのツリー表示は対策が必要です。 ** 仕様 [#q90c1fda] - ツリーに表示されたリンクをクリックすると、表示中のトピック内の記事にはそのまま記事部分にジャンプし、それ以外のトピにはページ遷移してその記事部分にジャンプします。 - プラグインの呼び出し例 #code(html,nonumber){{ <{d3comment_tree forum_dirname=$mydirname forum_id=$forum.id topic_id=$topic.id external_link_id=$topic.external_link_id order="ASC" postorder=$postorder item="tree"}> }} - プラグインの呼び出しの際のオプションは、以下です。 「order」以外は上記の呼び出し例どおりで問題ないはずです。 ++ forum_dirname: d3forumのディレクトリ名。d3forumテンプレート内では$mydirnameでOK。 ++ forum_id: コメント統合したd3forumのforum番号。d3forumテンプレート内では$forum.idでOK。 ++ topic_id: コメント統合記事以外の時に表示トピックを限定するための、topic番号。d3forumテンプレート内では$topic.idでOK。 ++ external_link_id: コメント統合記事の外部リンク番号。d3forumテンプレート内では$topic.external_link_idでOK。 ++ order: 表示の昇順/降順指定。 「ASC」=「降順」、「DESC」=「昇順」。 「d3forum_main_listposts.html 」内の記述では、ツリー構造順表示が標準ですので、ここでは何も指定しないでください。 ++ limit: ツリーに表示する最大タイトル数。 指定しなければ100件までを最大として表示します。(記事自体の表示件数ではありません。) ++ postorder: 「投稿の新しいものから」「投稿の古いものから」をクリックした時の、表示順変更のための変数。 d3forumテンプレート内では$postorderでOK。 ++ item: テンプレート内で参照する変数名。 ** コード [#z0805a20] sumartyプラグインを1つ作って、テンプレートから呼び出してテンプレート変数にアサインし、テンプレート内で表示します。 *** function.d3comment_tree.php [#qe129245] 以下のコードを「function.d3comment_tree.php」 として新規作成し、「(xoops_root_path)/class/smarty/plugins/」ディレクトリ内にアップします。 (2009/3/31:90行目でERRORが出ていたので修正しました。 2009/4/13:コメント統合記事かつトピックが2つ以上の場合のみ、「表示中トピック」インジケータが出るように変更しました。) #code(php,1-){{ <?php /* * Smarty plugin * ------------------------------------------------------------- * Type: function * Name: d3comment_tree * Version: 0.1.2 * Date: April 13, 2009 * Author: naao * Purpose: Shows comment trees in a external link id * Input: * * Examples: <{d3comment_tree forum_dirname=$mydirname forum_id=$forum.id topic_id=$topic.id external_link_id=$topic.external_link_id order="ASC" postorder=$postorder item="tree"}> * */ function smarty_function_d3comment_tree($params, &$smarty) { // transitional from 'dirname' -> 'forum_dirname' $params['forum_dirname'] = @$params['forum_dirname'] . @$params['dirname'] ; $forum_dirname = ! empty( $params['forum_dirname'] ) ? $params['forum_dirname'] : 'd3forum' ; $forum_id = ! empty( $params['forum_id'] ) ? intval( $params['forum_id'] ) : 1 ; $topic_id = ! empty( $params['topic_id'] ) ? intval( $params['topic_id'] ) : 0 ; $external_link_id = ! empty( $params['external_link_id'] ) ? intval( $params['external_link_id'] ) : 1 ; $limit = ! empty( $params['limit'] ) ? intval( $params['limit'] ) : 100 ; $_order = strtolower(@$params['order']) == 'asc' ? 'ASC' : (strtolower(@$params['order']) == 'desc' ? 'DESC' : '') ; $postorder = ! empty( $params['postorder'] ) ? intval( $params['postorder'] ) : 0 ; $item = ! empty( $params['item'] ) ? $params['item'] : 'tree' ; if ( $_order != '') { $disp_order = $_order ; $whr_order = "post_time DESC"; } else { switch ($postorder) { case 0: $whr_order = "t.topic_id ASC,p.order_in_tree,p.post_id"; break; case 2: $disp_order = 'ASC' ; $whr_order = "post_time DESC"; break; case 3: $whr_order = "post_time DESC"; break; default: } } if( ! preg_match( '/^[0-9a-zA-Z_-]+$/' , $forum_dirname ) || $forum_id <= 0 || $external_link_id <= 0 ) { echo "<p>d3comment_tree function does not set properly.</p>" ; } else { $db =& Database::getInstance() ; $myts =& MyTextSanitizer::getInstance() ; // main query $sql = "SELECT p.*,t.topic_locked,t.topic_id,t.forum_id FROM ".$db->prefix($forum_dirname."_posts")." p LEFT JOIN ".$db->prefix($forum_dirname."_topics")." t ON p.topic_id=t.topic_id WHERE t.forum_id='".$forum_id."' AND (topic_external_link_id='".addslashes($external_link_id)."' OR t.topic_id='".addslashes($topic_id)."') ORDER BY ".$whr_order." LIMIT ".$limit ; if( ! $trs = $db->query( $sql ) ) die( _MD_D3FORUM_ERR_SQL.__LINE__ ) ; $user_handler =& xoops_gethandler( 'user' ) ; $topics_count = 0; $topic_last_id = 0; while( $post_row = $db->fetchArray( $trs ) ) { // get this poster's object $poster_obj =& $user_handler->get( intval( $post_row['uid'] ) ) ; if( is_object( $poster_obj ) ) { $poster_uname4disp = $poster_obj->getVar( 'uname' ) ; } else { $poster_uname4disp = "" ; } $poster_uname4disp = $poster_uname4disp ? $poster_uname4disp : $myts->makeTboxData4Show( $post_row['guest_name'] ) ; // posts array $posts[] = array( 'id' => intval( $post_row['post_id'] ) , 'subject' => $myts->makeTboxData4Show( $post_row['subject'] , $post_row['number_entity'] , $post_row['special_entity'] ) , 'post_time_formatted' => formatTimestamp( $post_row['post_time'] , 'm' ) , 'poster_uid' => intval( $post_row['uid'] ) , 'poster_uname' => $poster_uname4disp , 'icon' => intval( $post_row['icon'] ) , 'depth_in_tree' => intval( $post_row['depth_in_tree'] ) , 'order_in_tree' => intval( $post_row['order_in_tree'] ) , 'topic_id' => intval( $post_row['topic_id'] ) , 'ul_in' => '<ul><li>' , 'ul_out' => '</li></ul>' , ) ; if (intval( $post_row['topic_id'] ) != $topic_last_id) { $topics_count ++ ; $topic_last_id = intval( $post_row['topic_id'] ); } } // reverse array if order is "ASC" if (($disp_order == 'ASC') && ($posts)) {$posts = array_reverse($posts);} $assign_name = @$params['item'] . @$params['assign'] ; $smarty->assign( $assign_name , $posts ) ; $smarty->assign( $assign_name."_tp_count" , $topics_count ) ; } } ?> }} *** d3forum_main_listposts.html [#q607f13d] テンプレート「(d3forum)_main_listposts.html」を編集します。 (A案)全投稿をツリー表示するか、(B案)当該ツリー以外はトピックリストを表示するか、テンプレートの編集で選択できます。 &ref(tree_alltree.jpg,mw:200); &ref(tree_topicslist.jpg,mw:200); **** A案:全topicの全postsツリー表示 [#f8cf2264] 当該元記事にぶらさがる、全トピックの全投稿を、ツリー表示します。 #code(html,1-){{ <!-- start module contents --> <div class="d3f_breadcrumbs"> <{if $mod_config.show_breadcrumbs}> <a href="<{$mod_url}>/index.php"><{$smarty.const._MD_D3FORUM_TOP}></a> > <{foreach from=$category.paths_raw key=parent_id item=parent_title_raw}> <a href="<{$mod_url}>/index.php?cat_id=<{$parent_id}>"><{$parent_title_raw|escape}></a> > <{/foreach}> <a href="<{$mod_url}>/index.php?forum_id=<{$forum.id}>"><{$forum.title}></a> <{/if}> <{if $prev_topic.id || $next_topic.id}> (<{if $prev_topic.id}> <a href="<{$mod_url}>/index.php?topic_id=<{$prev_topic.id}>" title="<{$prev_topic.title}>"><{$smarty.const._MD_D3FORUM_LINK_PREVTOPIC}></a> <{/if}> <{if $prev_topic.id && $next_topic.id}> | <{/if}> <{if $next_topic.id}> <a href="<{$mod_url}>/index.php?topic_id=<{$next_topic.id}>" title="<{$next_topic.title}>"><{$smarty.const._MD_D3FORUM_LINK_NEXTTOPIC}></a> <{/if}>) <{/if}> </div> <h1 class="d3f_title" style="clear:both"><{$topic.title}></h1> <{include file="db:`$mydirname`_inc_topicbar.html"}> <{include file="db:`$mydirname`_inc_d3comment_summary.html"}> <{d3comment_tree forum_dirname=$mydirname forum_id=$forum.id topic_id=$topic.id external_link_id=$topic.external_link_id postorder=$postorder item="tree"}> <!-- start post tree --> <h2 class="head d3f_tree d3f_head"><{$smarty.const._MD_D3FORUM_POSTSTREE}></h2> <{foreach from=$tree item=eachpost}> <{$eachpost.ul_in|replace:"<ul>":"<ul class='d3f_eachbranch'>\n\t"|replace:"<li>":"<li class='d3f_eachbranchitem'><span style='padding-left:`$eachpost.depth_in_tree`0px;'>"}> <a href="<{$mod_url}>/index.php?topic_id=<{$eachpost.topic_id}>#post_id<{$eachpost.id}>" id="post_path<{$eachpost.unique_path}>" name="post_path<{$eachpost.unique_path}>"><img src="<{$mod_imageurl}>/posticon<{$eachpost.icon}>.gif" alt="<{$icon_meanings[$eachpost.icon]}>" /> <{$eachpost.subject}></a> (<{$eachpost.poster_uname}>, <{$eachpost.post_time_formatted}>) <{if $forum.isadminormod}><a href="<{$mod_url}>/index.php?page=cutpasteposts&post_id=<{$eachpost.id}>"><img src="<{$mod_imageurl}>/adminicon_cutpaste.gif" alt="<{$smarty.const._MD_D3FORUM_CUTPASTEPOSTS}>" /></a><{/if}> <{if $topic.external_link_id && ($tree_tp_count > 1) && ($eachpost.topic_id==$topic.id) && ($eachpost.depth_in_tree==0)}><font color="red">★表示中トピック</font><{/if}></span> <{$eachpost.ul_out}> <{/foreach}> <!-- end post tree --> <{include file="db:`$mydirname`_inc_postorder_links.html"}> <br /> <!-- quick reply form --> <{if $first_post.can_reply && ($postorder==3)}> <{include file="db:`$mydirname`_inc_post_form_quick.html" uname=$xoops_uname h2_title=$smarty.const._MD_D3FORUM_POSTASSAMETOPIC quick_form_mode="sametopic" subject_raw=$first_post.subject_raw}> <{/if}> <div class="d3f_link"> <{$posts|@count|string_format:$smarty.const._MD_D3FORUM_FMT_POSTDISPLAYSINFO}> (<{$tree|@count|string_format:$smarty.const._MD_D3FORUM_FMT_POSTHITSINFO}>) <a href="<{$mod_url}>/index.php?forum_id=<{$forum.id}>&external_link_id=<{$topic.external_link_id|escape:"url"}>"><{$smarty.const._MD_D3FORUM_LINK_LISTALLCOMMENTS}></a></div> <!-- top of posts --> <div class="d3f_wrap"> <{foreach item=post from=$posts}> <{include file="db:`$mydirname`_inc_eachpost.html" post=$post caller="listposts" inner_link_format="#post_id%s"}> <{/foreach}> </div> <!-- bottom of posts --> <{include file="db:`$mydirname`_inc_postorder_links.html"}> <!-- quick reply form --> <{if $first_post.can_reply && ($postorder!=3)}> <{include file="db:`$mydirname`_inc_post_form_quick.html" uname=$xoops_uname h2_title=$smarty.const._MD_D3FORUM_POSTASSAMETOPIC quick_form_mode="sametopic" subject_raw=$first_post.subject_raw}> <{/if}> <!-- forum jump --> <form name="forum_jump_box" action="<{$mod_url}>/index.php" method="get" style="clear:both;" class="d3f_form"> <p> <select name="forum_id"><{$forum_jumpbox_options}></select> <input type="submit" value="<{$smarty.const._MD_D3FORUM_BTN_JUMPTOFORUM}>" /> <a href="<{$mod_url}>/index.php?page=search"><{$smarty.const._MD_D3FORUM_LINK_ADVSEARCH}></a> </p> </form> <hr class="notification" /> <{include file='db:system_notification_select.html'}> <!-- end module contents --> }} **** B案:当該topic内postsツリー + 全topicsリスト表示 [#i70d49ae] 当該元記事にぶらさがる、全トピックのうち当該トピックの投稿をツリー表示し、他のトピックはトピックの最初の投稿のみリスト表示します。 #code(html,1-){{ <!-- start module contents --> <div class="d3f_breadcrumbs"> <{if $mod_config.show_breadcrumbs}> <a href="<{$mod_url}>/index.php"><{$smarty.const._MD_D3FORUM_TOP}></a> > <{foreach from=$category.paths_raw key=parent_id item=parent_title_raw}> <a href="<{$mod_url}>/index.php?cat_id=<{$parent_id}>"><{$parent_title_raw|escape}></a> > <{/foreach}> <a href="<{$mod_url}>/index.php?forum_id=<{$forum.id}>"><{$forum.title}></a> <{/if}> <{if $prev_topic.id || $next_topic.id}> (<{if $prev_topic.id}> <a href="<{$mod_url}>/index.php?topic_id=<{$prev_topic.id}>" title="<{$prev_topic.title}>"><{$smarty.const._MD_D3FORUM_LINK_PREVTOPIC}></a> <{/if}> <{if $prev_topic.id && $next_topic.id}> | <{/if}> <{if $next_topic.id}> <a href="<{$mod_url}>/index.php?topic_id=<{$next_topic.id}>" title="<{$next_topic.title}>"><{$smarty.const._MD_D3FORUM_LINK_NEXTTOPIC}></a> <{/if}>) <{/if}> </div> <h1 class="d3f_title" style="clear:both"><{$topic.title}></h1> <{include file="db:`$mydirname`_inc_topicbar.html"}> <{include file="db:`$mydirname`_inc_d3comment_summary.html"}> <{d3comment_tree forum_dirname=$mydirname forum_id=$forum.id topic_id=$topic.id external_link_id=$topic.external_link_id postorder=$postorder item="tree"}> <!-- start post tree --> <h2 class="head d3f_tree d3f_head"><{$smarty.const._MD_D3FORUM_POSTSTREE}></h2> <{foreach from=$tree item=eachpost}> <{if ($eachpost.topic_id==$topic.id)}> <{$eachpost.ul_in|replace:"<ul>":"<ul class='d3f_eachbranch'>\n\t"|replace:"<li>":"<li class='d3f_eachbranchitem'><span style='padding-left:`$eachpost.depth_in_tree`0px;'>"}> <a href="<{$mod_url}>/index.php?topic_id=<{$eachpost.topic_id}>#post_id<{$eachpost.id}>" id="post_path<{$eachpost.unique_path}>" name="post_path<{$eachpost.unique_path}>"><img src="<{$mod_imageurl}>/posticon<{$eachpost.icon}>.gif" alt="<{$icon_meanings[$eachpost.icon]}>" /> <{$eachpost.subject}></a> (<{$eachpost.poster_uname}>, <{$eachpost.post_time_formatted}>) <{if $forum.isadminormod}><a href="<{$mod_url}>/index.php?page=cutpasteposts&post_id=<{$eachpost.id}>"><img src="<{$mod_imageurl}>/adminicon_cutpaste.gif" alt="<{$smarty.const._MD_D3FORUM_CUTPASTEPOSTS}>" /></a><{/if}></span> <{/if}> <{$eachpost.ul_out}> <{/foreach}> <!-- end topic list --> <!-- start topic list --> <{if $topic.external_link_id && ($tree_tp_count>1)}> <h2 class="head d3f_tree d3f_head"><{$smarty.const._MD_D3FORUM_LINK_LISTALLCOMMENTS}></h2> <{foreach from=$tree item=eachpost}> <{if ($eachpost.depth_in_tree==0)}> <{$eachpost.ul_in|replace:"<ul>":"<ul class='d3f_eachbranch'>\n\t"|replace:"<li>":"<li class='d3f_eachbranchitem'>"}> <a href="<{$mod_url}>/index.php?topic_id=<{$eachpost.topic_id}>#post_id<{$eachpost.id}>" id="post_path<{$eachpost.unique_path}>" name="post_path<{$eachpost.unique_path}>"><img src="<{$mod_imageurl}>/posticon<{$eachpost.icon}>.gif" alt="<{$icon_meanings[$eachpost.icon]}>" /> <{$eachpost.subject}></a> (<{$eachpost.poster_uname}>, <{$eachpost.post_time_formatted}>) <{if $forum.isadminormod}><a href="<{$mod_url}>/index.php?page=cutpasteposts&post_id=<{$eachpost.id}>"><img src="<{$mod_imageurl}>/adminicon_cutpaste.gif" alt="<{$smarty.const._MD_D3FORUM_CUTPASTEPOSTS}>" /></a><{/if}> <{if ($eachpost.topic_id==$topic.id) && ($eachpost.depth_in_tree==0)}><font color="red">★表示中トピック</font><{/if}> <{/if}> <{$eachpost.ul_out}> <{/foreach}> <{/if}> <!-- end post tree --> <br /> <{include file="db:`$mydirname`_inc_postorder_links.html"}> <br /> <!-- quick reply form --> <{if $first_post.can_reply && ($postorder==3)}> <{include file="db:`$mydirname`_inc_post_form_quick.html" uname=$xoops_uname h2_title=$smarty.const._MD_D3FORUM_POSTASSAMETOPIC quick_form_mode="sametopic" subject_raw=$first_post.subject_raw}> <{/if}> <div class="d3f_link"> <{$posts|@count|string_format:$smarty.const._MD_D3FORUM_FMT_POSTDISPLAYSINFO}> (<{$tree|@count|string_format:$smarty.const._MD_D3FORUM_FMT_POSTHITSINFO}>) <a href="<{$mod_url}>/index.php?forum_id=<{$forum.id}>&external_link_id=<{$topic.external_link_id|escape:"url"}>"><{$smarty.const._MD_D3FORUM_LINK_LISTALLCOMMENTS}></a></div> <!-- top of posts --> <div class="d3f_wrap"> <{foreach item=post from=$posts}> <{include file="db:`$mydirname`_inc_eachpost.html" post=$post caller="listposts" inner_link_format="#post_id%s"}> <{/foreach}> </div> <!-- bottom of posts --> <{include file="db:`$mydirname`_inc_postorder_links.html"}> <!-- quick reply form --> <{if $first_post.can_reply && ($postorder!=3)}> <{include file="db:`$mydirname`_inc_post_form_quick.html" uname=$xoops_uname h2_title=$smarty.const._MD_D3FORUM_POSTASSAMETOPIC quick_form_mode="sametopic" subject_raw=$first_post.subject_raw}> <{/if}> <!-- forum jump --> <form name="forum_jump_box" action="<{$mod_url}>/index.php" method="get" style="clear:both;" class="d3f_form"> <p> <select name="forum_id"><{$forum_jumpbox_options}></select> <input type="submit" value="<{$smarty.const._MD_D3FORUM_BTN_JUMPTOFORUM}>" /> <a href="<{$mod_url}>/index.php?page=search"><{$smarty.const._MD_D3FORUM_LINK_ADVSEARCH}></a> </p> </form> <hr class="notification" /> <{include file='db:system_notification_select.html'}> <!-- end module contents --> <!-- start module contents --> <!-- breadcrumbs --> <{if $mod_config.show_breadcrumbs}> <div class="d3f_breadcrumbs"> <{strip}> <a href="<{$mod_url}>/index.php"><{$smarty.const._MD_D3FORUM_TOP}></a> > <{foreach from=$category.paths_raw key=parent_id item=parent_title_raw}> <a href="<{$mod_url}>/index.php?cat_id=<{$parent_id}>"><{$parent_title_raw|escape}></a> > <{/foreach}> <a href="<{$mod_url}>/index.php?forum_id=<{$forum.id}>"><{$forum.title}></a> > <a href="<{$mod_url}>/index.php?topic_id=<{$topic.id}>"><{$topic.title}></a> <{/strip}> </div> <{/if}> <h1 class="d3f_title"><{$post.subject}></h1> <{include file="db:`$mydirname`_inc_d3comment_summary.html"}> <div class="d3f_link"> <{$posts|@count|string_format:$smarty.const._MD_D3FORUM_FMT_POSTDISPLAYSINFO}> <a href="<{$mod_url}>/index.php?forum_id=<{$forum.id}>&external_link_id=<{$topic.external_link_id|escape:"url"}>"><{$smarty.const._MD_D3FORUM_LINK_LISTALLCOMMENTS}></a></div> <!-- start post tree --> <h2 class="head d3f_tree d3f_head"><{$smarty.const._MD_D3FORUM_POSTSTREE}></h2> <{foreach from=$posts item=eachpost}> <{if $eachpost.id == $post.id}> <{$eachpost.ul_in|replace:"<ul>":"<ul class='d3f_eachbranch'>\n\t"|replace:"<li>":"<li class='d3f_eachbranchitem d3f_currenttopic'><span style='padding-left:`$eachpost.depth_in_tree`0px;'>"}> <{else}> <{$eachpost.ul_in|replace:"<ul>":"<ul class='d3f_eachbranch'>\n\t"|replace:"<li>":"<li class='d3f_eachbranchitem'><span style='padding-left:`$eachpost.depth_in_tree`0px;'>"}> <{/if}> <a href="<{$mod_url}>/index.php?post_id=<{$eachpost.id}>" id="post_path<{$eachpost.unique_path}>" name="post_path<{$eachpost.unique_path}>"><img src="<{$mod_imageurl}>/posticon<{$eachpost.icon}>.gif" alt="<{$icon_meanings[$eachpost.icon]}>" /> <{$eachpost.subject}></a> (<{$eachpost.poster_uname}>, <{$eachpost.post_time_formatted}>) <{if $forum.isadminormod}><a href="<{$mod_url}>/index.php?page=cutpasteposts&post_id=<{$eachpost.id}>"><img src="<{$mod_imageurl}>/adminicon_cutpaste.gif" alt="<{$smarty.const._MD_D3FORUM_CUTPASTEPOSTS}>" /></a><{/if}></span> <{$eachpost.ul_out}> <{/foreach}> <!-- end post tree --> <{d3comment_tree forum_dirname=$mydirname forum_id=$forum.id topic_id=$topic.id external_link_id=$topic.external_link_id postorder=$postorder item="tree"}> <!-- start topic list --> <{if $topic.external_link_id && ($tree_tp_count>1)}> <h2 class="head d3f_tree d3f_head"><{$smarty.const._MD_D3FORUM_LINK_LISTALLCOMMENTS}></h2> <{foreach from=$tree item=eachpost}> <{if ($eachpost.depth_in_tree==0)}> <{$eachpost.ul_in|replace:"<ul>":"<ul class='d3f_eachbranch'>\n\t"|replace:"<li>":"<li class='d3f_eachbranchitem'>"}> <a href="<{$mod_url}>/index.php?topic_id=<{$eachpost.topic_id}>#post_id<{$eachpost.id}>" id="post_path<{$eachpost.unique_path}>" name="post_path<{$eachpost.unique_path}>"><img src="<{$mod_imageurl}>/posticon<{$eachpost.icon}>.gif" alt="<{$icon_meanings[$eachpost.icon]}>" /> <{$eachpost.subject}></a> (<{$eachpost.poster_uname}>, <{$eachpost.post_time_formatted}>) <{if $forum.isadminormod}><a href="<{$mod_url}>/index.php?page=cutpasteposts&post_id=<{$eachpost.id}>"><img src="<{$mod_imageurl}>/adminicon_cutpaste.gif" alt="<{$smarty.const._MD_D3FORUM_CUTPASTEPOSTS}>" /></a><{/if}> <{if ($eachpost.topic_id==$topic.id) && ($eachpost.depth_in_tree==0)}><font color="red">★表示中トピック</font><{/if}> <{/if}> <{$eachpost.ul_out}> <{/foreach}> <{/if}> <!-- end post tree --> <br /> <p class="d3f_topicinfo"><a href="<{$mod_url}>/index.php?topic_id=<{$topic.id}>"><{$smarty.const._MD_D3FORUM_LINK_LISTPOSTS}></a></p> <div class="d3f_wrap"> <{include file="db:`$mydirname`_inc_eachpost.html" caller="viewpost" inner_link_format="`$mod_url`/index.php?post_id=%s"}> </div> <!-- quick reply form --> <{if $post.can_reply}> <{include file="db:`$mydirname`_inc_post_form_quick.html" uname=$xoops_uname h2_title=$smarty.const._MD_D3FORUM_REPLYTHISPOST quick_form_mode="reply" subject_raw=$post.subject_raw}> <{/if}> <!-- forum jump --> <form name="forum_jump_box" action="<{$mod_url}>/index.php" method="get" style="clear:both;"> <p> <select name="forum_id"><{$forum_jumpbox_options}></select> <input type="submit" value="<{$smarty.const._MD_D3FORUM_BTN_JUMPTOFORUM}>" /> <a href="<{$mod_url}>/index.php?page=search"><{$smarty.const._MD_D3FORUM_LINK_ADVSEARCH}></a> </p> </form> <hr class="notification" /> <{include file='db:system_notification_select.html'}> <!-- end module contents --> }} *** d3forum_main_viewpost.html [#kb559619] 1ポスト表示においても、上記のB案に準じたtopicsリスト表示が希望の場合には、テンプレート「(d3forum)_main_viewpost.html」を編集します。 &ref(tree_viewpost.jpg,mw:200,mh:200); #code(html,1-){{ <!-- start module contents --> <!-- breadcrumbs --> <{if $mod_config.show_breadcrumbs}> <div class="d3f_breadcrumbs"> <{strip}> <a href="<{$mod_url}>/index.php"><{$smarty.const._MD_D3FORUM_TOP}></a> > <{foreach from=$category.paths_raw key=parent_id item=parent_title_raw}> <a href="<{$mod_url}>/index.php?cat_id=<{$parent_id}>"><{$parent_title_raw|escape}></a> > <{/foreach}> <a href="<{$mod_url}>/index.php?forum_id=<{$forum.id}>"><{$forum.title}></a> > <a href="<{$mod_url}>/index.php?topic_id=<{$topic.id}>"><{$topic.title}></a> <{/strip}> </div> <{/if}> <h1 class="d3f_title"><{$post.subject}></h1> <{include file="db:`$mydirname`_inc_d3comment_summary.html"}> <div class="d3f_link"> <{$posts|@count|string_format:$smarty.const._MD_D3FORUM_FMT_POSTDISPLAYSINFO}> <a href="<{$mod_url}>/index.php?forum_id=<{$forum.id}>&external_link_id=<{$topic.external_link_id|escape:"url"}>"><{$smarty.const._MD_D3FORUM_LINK_LISTALLCOMMENTS}></a></div> <!-- start post tree --> <h2 class="head d3f_tree d3f_head"><{$smarty.const._MD_D3FORUM_POSTSTREE}></h2> <{foreach from=$posts item=eachpost}> <{if $eachpost.id == $post.id}> <{$eachpost.ul_in|replace:"<ul>":"<ul class='d3f_eachbranch'>\n\t"|replace:"<li>":"<li class='d3f_eachbranchitem d3f_currenttopic'><span style='padding-left:`$eachpost.depth_in_tree`0px;'>"}> <{else}> <{$eachpost.ul_in|replace:"<ul>":"<ul class='d3f_eachbranch'>\n\t"|replace:"<li>":"<li class='d3f_eachbranchitem'><span style='padding-left:`$eachpost.depth_in_tree`0px;'>"}> <{/if}> <a href="<{$mod_url}>/index.php?post_id=<{$eachpost.id}>" id="post_path<{$eachpost.unique_path}>" name="post_path<{$eachpost.unique_path}>"><img src="<{$mod_imageurl}>/posticon<{$eachpost.icon}>.gif" alt="<{$icon_meanings[$eachpost.icon]}>" /> <{$eachpost.subject}></a> (<{$eachpost.poster_uname}>, <{$eachpost.post_time_formatted}>) <{if $forum.isadminormod}><a href="<{$mod_url}>/index.php?page=cutpasteposts&post_id=<{$eachpost.id}>"><img src="<{$mod_imageurl}>/adminicon_cutpaste.gif" alt="<{$smarty.const._MD_D3FORUM_CUTPASTEPOSTS}>" /></a><{/if}></span> <{$eachpost.ul_out}> <{/foreach}> <!-- end post tree --> <{d3comment_tree forum_dirname=$mydirname forum_id=$forum.id topic_id=$topic.id external_link_id=$topic.external_link_id postorder=$postorder item="tree"}> <!-- start topic list --> <{if $topic.external_link_id && ($tree_tp_count>1)}> <h2 class="head d3f_tree d3f_head"><{$smarty.const._MD_D3FORUM_LINK_LISTALLCOMMENTS}></h2> <{foreach from=$tree item=eachpost}> <{if ($eachpost.depth_in_tree==0)}> <{$eachpost.ul_in|replace:"<ul>":"<ul class='d3f_eachbranch'>\n\t"|replace:"<li>":"<li class='d3f_eachbranchitem'>"}> <a href="<{$mod_url}>/index.php?topic_id=<{$eachpost.topic_id}>#post_id<{$eachpost.id}>" id="post_path<{$eachpost.unique_path}>" name="post_path<{$eachpost.unique_path}>"><img src="<{$mod_imageurl}>/posticon<{$eachpost.icon}>.gif" alt="<{$icon_meanings[$eachpost.icon]}>" /> <{$eachpost.subject}></a> (<{$eachpost.poster_uname}>, <{$eachpost.post_time_formatted}>) <{if $forum.isadminormod}><a href="<{$mod_url}>/index.php?page=cutpasteposts&post_id=<{$eachpost.id}>"><img src="<{$mod_imageurl}>/adminicon_cutpaste.gif" alt="<{$smarty.const._MD_D3FORUM_CUTPASTEPOSTS}>" /></a><{/if}> <{if ($eachpost.topic_id==$topic.id) && ($eachpost.depth_in_tree==0)}><font color="red">★表示中トピック</font><{/if}> <{/if}> <{$eachpost.ul_out}> <{/foreach}> <{/if}> <!-- end post tree --> <br /> <p class="d3f_topicinfo"><a href="<{$mod_url}>/index.php?topic_id=<{$topic.id}>"><{$smarty.const._MD_D3FORUM_LINK_LISTPOSTS}></a></p> <div class="d3f_wrap"> <{include file="db:`$mydirname`_inc_eachpost.html" caller="viewpost" inner_link_format="`$mod_url`/index.php?post_id=%s"}> </div> <!-- quick reply form --> <{if $post.can_reply}> <{include file="db:`$mydirname`_inc_post_form_quick.html" uname=$xoops_uname h2_title=$smarty.const._MD_D3FORUM_REPLYTHISPOST quick_form_mode="reply" subject_raw=$post.subject_raw}> <{/if}> <!-- forum jump --> <form name="forum_jump_box" action="<{$mod_url}>/index.php" method="get" style="clear:both;"> <p> <select name="forum_id"><{$forum_jumpbox_options}></select> <input type="submit" value="<{$smarty.const._MD_D3FORUM_BTN_JUMPTOFORUM}>" /> <a href="<{$mod_url}>/index.php?page=search"><{$smarty.const._MD_D3FORUM_LINK_ADVSEARCH}></a> </p> </form> <hr class="notification" /> <{include file='db:system_notification_select.html'}> <!-- end module contents --> }} *** おまけ d3forum_comment_listposts_flat.html [#y9945beb] **** おまけ-1(A案) [#nb37c13c] テンプレート「(d3forum)_comment_listposts_flat.html」の一番頭に以下を追記することで、コメント元表示でもツリー表示できます。 これも、topicへのジャンプでなくpost1記事へのジャンプでよければ、プラグインの呼び出しは不要で、テンプレート編集のみでいけますが、折角なのでプラグインでお試しください。 但し、%%コメント元のモジュール単位でパラメータ変更ができませんので、同一サイト内の全モジュールのコメント統合表示が同じ設定になります。%% → モジュール側のコメント統合設定で「コメントの昇順/降順」「最大コメント数」の設定ができる場合、それを反映するようにしました。 #code(html,1-){{ <{d3comment_tree forum_dirname=$mydirname forum_id=$forum.id external_link_id=$external_link_id order=$plugin_params.order limit=$plugin_params.limit item="tree"}> <!-- start post tree --> <h2 class="head d3f_tree d3f_head"><a name="comment"><{$smarty.const._MD_D3FORUM_POSTSTREE}></a></h2> <{foreach from=$tree item=eachpost}> <ul class='d3f_eachbranch'><{"<span style='padding-left:`$eachpost.depth_in_tree`0px; padding-top: 0;'>"}> <a href="<{$mod_url}>/index.php?topic_id=<{$eachpost.topic_id}>#post_id<{$eachpost.id}>" id="post_path<{$eachpost.unique_path}>" name="post_path<{$eachpost.unique_path}>"><img src="<{$mod_imageurl}>/posticon<{$eachpost.icon}>.gif" alt="<{$icon_meanings[$eachpost.icon]}>" /> <{$eachpost.subject}></a> (<{$eachpost.poster_uname}>, <{$eachpost.post_time_formatted}>) <{if $forum.isadminormod}><a href="<{$mod_url}>/index.php?page=cutpasteposts&post_id=<{$eachpost.id}>"><img src="<{$mod_imageurl}>/adminicon_cutpaste.gif" alt="<{$smarty.const._MD_D3FORUM_CUTPASTEPOSTS}>" /></a><{/if}></span> <{$eachpost.ul_out}> <{/foreach}> <!-- end post tree --> }} **** おまけ-2(B案) [#i55e3768] 上記「おまけ」の記述だと、ツリーをクリックするとd3forumのトピ表示にページ遷移しますが、やはりコメント元ページでは そのページ内の各コメントにジャンプすべきかと思います。 ただ、それだけでは「他にどんなトピがあるのか」が判らないので、トピ一覧も表示するようにテンプレートのみ編集してみました。 [[表示例:http://www.naaon.com/modules/plactice/index.php/home/hobby/xoops/pical_091h_1.htm#comment]] (当サイト内) ちょっと「くどい」気もしますが、サイト管理上の使い勝手は中々ではないでしょうか。 よろしければ、下記のコードでどうぞ。 なお、ALTSYSでフォーラムの言語定数設定にて、「_MD_D3FORUM_LINK_LISTALLCOMMENTS」を「すべてのコメント一覧へ」→「この記事へのトピック一覧」に変更すると、随所で判りやすくなると思います。 #code(html,1-){{ <h2 class="head d3f_tree d3f_head"><a name="comment"><{$smarty.const._MD_D3FORUM_POSTSTREE}></a></h2> <!-- start post tree --> <{foreach from=$posts item=eachpost}> <ul class='d3f_eachbranch'><{"<span style='padding-left:`$eachpost.depth_in_tree`0px; padding-top: 0;'>"}> <a href="#post_id<{$eachpost.id}>" id="post_path<{$eachpost.unique_path}>" name="post_path<{$eachpost.unique_path}>"><img src="<{$mod_imageurl}>/posticon<{$eachpost.icon}>.gif" alt="<{$icon_meanings[$eachpost.icon]}>" /> <{$eachpost.subject}></a> (<{$eachpost.poster_uname}>, <{$eachpost.post_time_formatted}>) <{if $forum.isadminormod}><a href="<{$mod_url}>/index.php?page=cutpasteposts&post_id=<{$eachpost.id}>"><img src="<{$mod_imageurl}>/adminicon_cutpaste.gif" alt="<{$smarty.const._MD_D3FORUM_CUTPASTEPOSTS}>" /></a><{/if}></span> </ul> <{/foreach}> <!-- end post tree --> <br /> <div class="d3f_link"> <{$posts|@count|string_format:$smarty.const._MD_D3FORUM_FMT_POSTDISPLAYSINFO}> (<{$post_hits|string_format:$smarty.const._MD_D3FORUM_FMT_POSTHITSINFO}>) <a href="<{$mod_url}>/index.php?forum_id=<{$forum.id}>&external_link_id=<{$external_link_id|escape:"url"}>"><{$smarty.const._MD_D3FORUM_LINK_LISTALLCOMMENTS}></a></div> <br /> <{d3comment_tree forum_dirname=$mydirname forum_id=$forum.id external_link_id=$external_link_id order=$plugin_params.order item="tree"}> <{if $tree_tp_count > 1}> <{foreach from=$tree item=eachpost}> <{if $eachpost.depth_in_tree == 0}> <a href="<{$mod_url}>/index.php?topic_id=<{$eachpost.topic_id}>#post_id<{$eachpost.id}>" id="post_path<{$eachpost.unique_path}>" name="post_path<{$eachpost.unique_path}>"><img src="<{$mod_imageurl}>/posticon<{$eachpost.icon}>.gif" alt="<{$icon_meanings[$eachpost.icon]}>" /> <{$eachpost.subject}></a> (<{$eachpost.poster_uname}>, <{$eachpost.post_time_formatted}>) <br /> <{/if}> <{/foreach}> <{/if}> <{if $plugin_params.order != 'asc'}> <!-- begin simple comment form --> <{if $forum.can_post && ! $plugin_params.no_form}> <{include file="db:`$mydirname`_inc_post_form_quick.html" h2_title=$smarty.const._MD_D3FORUM_POSTASCOMMENTTOP quick_form_mode="sametopic"}> <{/if}> <!-- end simple comment form --> <{/if}> <h2 class="head"><{if $plugin_params.h2_comments}><{$plugin_params.h2_comments}><{else}><{$smarty.const._MD_D3FORUM_COMMENTSLIST}><{/if}></h2> <{if $pagenav}><div class="d3f_pagenav"><{$pagenav}></div><{/if}> <{if $forum.can_post && $plugin_params.no_form}> <!-- link to comment input form --> <div><a href="<{$mod_url}>/index.php?page=newtopic&forum_id=<{$forum.id}>&external_link_id=<{$external_link_id|escape:"url"}>&subject=<{$subject|escape:"url"}>"><{if $plugin_params.link_to_form}><{$plugin_params.link_to_form}><{else}><{$smarty.const._MD_D3FORUM_POSTASCOMMENTTOP}><{/if}></a></div> <{/if}> <!-- top of posts --> <div class="d3f_wrap" id="d3comment_listposts_flat"> <{foreach item=post from=$posts}> <div class="head d3f_head"> <a href="<{$mod_url}>/index.php?post_id=<{$post.id}>" id="post_path<{$post.unique_path}>" name="post_id<{$post.id}>"><{$post.subject}></a> </div> <div class="d3f_info_ctrl" style="float:right;"> <{if $post.can_edit}> <a href="<{$mod_url}>/index.php?page=edit&post_id=<{$post.id}>"><{$smarty.const._MD_D3FORUM_POSTEDIT}></a> | <{/if}> <{if $post.can_delete}> <a href="<{$mod_url}>/index.php?page=delete&post_id=<{$post.id}>"><{$smarty.const._MD_D3FORUM_POSTDELETE}></a> | <{/if}> <{if $post.can_reply}> <a href="<{$mod_url}>/index.php?page=reply&post_id=<{$post.id}>"><{$smarty.const._MD_D3FORUM_POSTREPLY}></a> <{/if}> </div> <div class="d3f_info even"> <{if $post.poster_uid != 0}><a href="<{$xoops_url}>/userinfo.php?uid=<{$post.poster_uid}>"><{$post.poster_uname}></a><{else}><{$post.poster_uname}> <span class="d3f_trip"><{$post.guest_trip}></trip><{/if}> <{$smarty.const._MD_D3FORUM_ON}> <{$post.post_time_formatted}> <{if $post.post_time < $post.modified_time}> | <span title="<{$post.modified_time_formatted}>"><{$smarty.const._MD_D3FORUM_LASTMODIFIED}></span><{/if}> </div> <div class="d3f_body" style="padding: 2px 2px 16px 16px; clear: both;"> <{$post.post_text}> </div> <{/foreach}> </div> <!-- bottom of posts --> <div class="d3f_link"> <{$posts|@count|string_format:$smarty.const._MD_D3FORUM_FMT_POSTDISPLAYSINFO}> (<{$post_hits|string_format:$smarty.const._MD_D3FORUM_FMT_POSTHITSINFO}>) <a href="<{$mod_url}>/index.php?forum_id=<{$forum.id}>&external_link_id=<{$external_link_id|escape:"url"}>"><{$smarty.const._MD_D3FORUM_LINK_LISTALLCOMMENTS}></a></div> <{if $pagenav}><div class="d3f_pagenav"><{$pagenav}></div><{/if}> <{if $plugin_params.order == 'asc'}> <!-- begin simple comment form --> <{if $forum.can_post && ! $plugin_params.no_form}> <{include file="db:`$mydirname`_inc_post_form_quick.html" h2_title=$smarty.const._MD_D3FORUM_POSTASCOMMENTTOP quick_form_mode="sametopic"}> <{/if}> <!-- end simple comment form --> <{/if}> }}
« Prev
inc/d3forum/d3com_tree のバックアップソース(No. All)
現: 2026-08-13 (木) 08:56:06
なーお
ぺージ情報
ぺージ名 :
inc/d3forum/d3com_tree
ページ別名 :
未設定
ページ作成 :
なーお
閲覧可
グループ :
すべての訪問者
ユーザー :
すべての訪問者
編集可
グループ :
なし
ユーザー :
なし
Counter: 10, today: 3, yesterday: 2
Go Page Top
Powered by XCL 2.5.0 © 2005-2025
The XOOPSCube Project
, theme design by
BCOOL
ログイン
IDとパスワードを記憶
ログイン
パスワード紛失
|
新規登録
メインメニュー
ホーム
マイフレンド
ラン記録
Xpwiki
新規ページ作成
最新ページ一覧
全ページ一覧
ヘルプ
» 関連ページ
» Wikiソース
» 編集履歴
»...
»...
画像管理
なーお'nぶろぐ
研究室
新着情報
大会リスト
フォーラム
シューズ
テーマ選択
Cube
bs5-starter
green_forest
xcl_default
4
テーマ