• 追加された行はこの色です。
  • 削除された行はこの色です。
#freeze
*relatedlist.inc.php [#nfd6d9b3]

関連付けられているページを、listプラグインのように、ページ名の頭の文字で分類して一覧表示します。

**書式 [#b306cf4c]

 #relatedlist([pagename])

:pagename|対象とするページ名。ここで指定されたページに関連付けられているページ一覧を表示する。省略時は、設置してあるページ。

**使い方 [#k9d0de7f]

例を示す。

 #relatedlist(FrontPage)

とすると、次のようになる。

#relatedlist(FrontPage)

**仕様 [#rab27d5f]

relatedプラグインと違って、そのページからリンクしているページはリストにしません。

**ダウンロード [#c79eea11]

現在公開はしていません。
簡単なので、コードを貼り付けておきます。

#pageinfo([[:Category/PukiWiki]],2006-06-06 (火) 00:51:59,DOBON!,2006-06-07 (水) 11:54:20,rakuppe)
#code(php){{
<?php

//relatedlist.inc.php
//based on related.inc.php
//Version 0.0.1
//作成者:どぼん!

//除外するページの正規表現パターン
define('PLUGIN_RELATEDLIST_EXCEPT', '/(?:^|\/)template$/');

function plugin_relatedlist_init()
{
	global $whatsnew, $whatsdeleted, $menubar;
	
	//除外するページを指定する
    $_plugin_relatedlist_messages = array(
	    '_plugin_relatedlist_except_pages'=>
	    	array($whatsnew, $whatsdeleted, $menubar),
    );
    set_plugin_messages($_plugin_relatedlist_messages);
}

function plugin_relatedlist_convert()
{
	global $vars, $script, $non_list, $defaultpage;
	global $_plugin_relatedlist_except_pages;

	$args = func_get_args();

	$page = isset($args[0]) ?
		strip_bracket(array_shift($args)) : $vars['page'];
	if (empty($page)) $page = $defaultpage;

	$pages = array_keys(links_get_related_db($page));
	//$non_listを除外する
	$pages = array_diff($pages,
		preg_grep('/' . $non_list . '/S', $pages));
	//設定によりさらにページを除外する
	if (PLUGIN_RELATEDLIST_EXCEPT != '')
		$pages = array_diff($pages,
			preg_grep(PLUGIN_RELATEDLIST_EXCEPT, $pages));
	if (!empty($_plugin_relatedlist_except_pages))
		$pages = array_diff($pages, $_plugin_relatedlist_except_pages);

	if (empty($pages))
		return '<ul><li>No related pages found.</li></ul>' . "\n";
	
	return page_list($pages);
}

?>
}}

**ライセンス [#tcb1a5ab]

GPL

**コメント [#r313725e]

#comment

#pageinfo([[:Category/PukiWiki]],2006-06-06 (火) 00:51:59,DOBON!,2006-07-11 (火) 01:53:19,DOBON!)

[ トップ ]   [ 新規 | 子ページ作成 | 一覧 | 単語検索 | 最終更新 | ヘルプ ]