使い方 - v1.7
| Table of Contents |
リファレンス
例
$wikinote_navi = ''; if (exist_plugin('wikinote')) { $wikinote = new PluginWikinote(array('prefix' => 'Note/', 'except' => '^$')); if ($wikinote->is_effect()) { if ($wikinote->is_notepage()) { $wikinote_navi = $wikinote->show_tabs(array( array('cmd'=>'edit', 'label'=>'編集', 'href'=>'?cmd=edit&page=$page'), array('cmd'=>'diff', 'label'=>'差分', 'href'=>'?cmd=diff&page=$page'), array('cmd'=>'main', 'label'=>'本文'), array('cmd'=>'note', 'label'=>'コメント'), )); } else { $wikinote_navi = $wikinote->show_tabs(array( array('cmd'=>'main', 'label'=>'本文'), array('cmd'=>'note', 'label'=>'コメント'), )); } $wikinote->autocreate_notepage(); } } echo $wikinote_navi;
Sample
pukiwiki 本家デフォルトスキンでは次のように設置すると良いかもしれません。 せっかく隙間があるので topicpath も表示させています。
skin/pukiwiki.skin.php
<td valign="top"> <div id="body"><?php echo $body ?></div> </td>
↓
// ------------------------------------------------------------
// Setting
// Set wikinote plugin
$wikinote_ini = array('prefix' => 'Note/', 'except' => '^$');
$wikinote_autocreate_notepage = false;
$wikinote_notepage_prefix_title = 'コメント';
$wikinote_tabs = array(
array('cmd'=>'main', 'label'=>'本文'),
array('cmd'=>'note', 'label'=>'コメント'),
array('cmd'=>'edit', 'label'=>'編集'), 'href'=>'?cmd=edit&page=$page'),
array('cmd'=>'diff', 'label'=>'差分'), 'href'=>'?cmd=diff&page=$page'),
);
// ------------------------------------------------------------
// Code
// Navigation tab (Wikinote)
$wikinote_navi = '';
if (exist_plugin('wikinote')) {
$wikinote = new PluginWikinote($wikinote_ini);
if ($wikinote->is_effect()) {
$wikinote_navi = $wikinote->show_tabs($wikinote_tabs);
if ($wikinote_autocreate_notepage) $wikinote->autocreate_notepage();
}
}
// ------------------------------------------------------------
// Output
・
・
<td valign="top">
<?php if ($wikinote->is_effect()) { echo $wikinote_navi; } ?>
<?php if (arg_check('read') && exist_plugin_inline('topicpath')) {
echo '<div class="topicpath">' . do_plugin_inline('topicpath') . '</div>';
} ?>
<?php if ($wikinote->is_effect()) { echo '<div style="clear:both;"></div>'; } ?>
<?php if ($wikinote->is_effect()) { echo '<div id="wrap_body">'; } ?>
<div id="body"><?php echo $body ?></div>
<?php if ($wikinote->is_effect()) { echo '</div>'; } ?>
</td>
・
・
日本語を label に使用する場合は pukiwiki.skin.php の文字コードを pukiwiki に合わせてください(EUC or UTF-8)。
pukiwiki.css.php
/* wikinote.inc.php */
ul.wikinote{
float:right;
list-style-type:none;
padding:0;
margin:0;
line-height:2em;
overflow:visible;
}
ul.wikinote li{
display:inline;
}
ul.wikinote li a {
border:1px solid black;
text-decoration:none;
background-color:#DDEEFF;
margin:0 5px;
padding:4px 10px 1em 10px;
}
ul.wikinote li a:hover {
}
ul.wikinote li.selected a {
color:#000;
position:relative;
z-index:1;
line-height:2em;
background-color:#fff;
border-bottom:none;
padding-bottom:.45em;/*adjust me*/
text-decoration:none;
}
div#wrap_body {
position:relative;
background:#fff;
margin:0px;
padding:0px;
border-top:1px solid black;
padding-top:5px;
}
ダウンロード:
wikinote.css
配置を変えるような修正をする場合は、インラインのタブ・メニュー
を読んで動作理解をしてからの
ほうが最終的には時間短縮になるかもしれません。
Reference
- CSS Tabs | unraveled
- ul で下線を引いて background-color 上書き可能に。そのため float:right; で下線が width:100%; 的にならず - インラインのタブ・メニュー
-- z-index: を用いて線を上書き(position:relative;のとき有効になる)。こちら式。
Additional Configuration - template
ノートページ用テンプレートが利用できます。
テンプレートページが作成されていない場合、
#comment
が使用されます。
テンプレートページ名の定義は通常ページと同じく、pukiwiki.ini.php 中の $auto_template_rules が使用されます。 デフォルト
$auto_template_rules = array(
'((.+)\/([^\/]+))' => '\2/template'
);
の場合、例えば本文ページ名が ほげほげ/ぶらぶら の場合、ノートページ名が Note/ほげほげ/ぶらぶら になりますので、 Note/ほげほげ/template が探索されることになります。
私は
$auto_template_rules = array(
'((.+)\/([^\/]+))' => '\2/template'
'(([^\/]+)\/(.+))' => '\2/template'
'(()(.*))' => 'template'
);
のようにして、Note/ 接頭辞のついた全ページに Note/template を適用可、 ついでに全ページ用のテンプレート template を用意可にしています。 本当は Note/ほげほげ/ぶらぶら/ぺけぺけ → Note/ほげほげ/ぶらぶら/template → Note/ほげほげ/template → Note/template → template としたいのですが、この pukiwiki の仕様では無理があります。
ついでに $non_list にも template を登録して、隠れるようにしています。
$non_list = '^:|(^|\/)template$'
参考
FAQ
- 途中で prefix を代えたくなった場合は
prefix を変更して設置し、 rename プラグインを用いてノートページ名を変更すると良いでしょう。 そのわずかな隙にノートページが作成されても上書きできます。
- 本文ページとノートページを一緒に移動したい
それも rename プラグインでできます。
- 本文ページとノートページを一緒に消去したい
- ノートページは最終更新(recent) に載って欲しくない
prefix を :Note/ とするか、pukiwiki.ini.php 中の $non_list を
$non_list = '^:|^Note\/';
とすると良いでしょう。
- すでにできてしまったノートページの内容を変えたい
replace プラグインや、Plugin/regexp.inc.php を使用して、#comment の文字を置き換えると良いかもしれません。



