view counterをInstallしたが、色々気に入らないので、まずはcounterを直してみた。
方針は、
を表示すること。
高々これだけでも結構面倒。少しPHPを勉強する気になった。
以下、Install方法
<?php /* * DokuWiki Counter * Original: Dokuwiki:plugins:viewcounter * Revised by seirios@seirios.org. * log: 2009/02/07 First Revision * * Function: Print view counter of followings. * - Today's unique viewers * - Today's all viewers * - Total of "Today's unique viewers" * - Total viewers */ global $ID, $ACT; $views_str = "views"; $myip = "<".$_SERVER["REMOTE_ADDR"].">"; $ips = ""; $unique = true; $todayviews = 1; $utodayviews = 1; $allviews = 1; $uallviews = 1; $d = date("Ymd"); $file = realpath($conf["datadir"])."/_views/".$ID; if (file_exists($file)) { $content = file_get_contents($file); $pos = strpos($content, " "); if ($pos !== FALSE) { $todayviews = substr($content, 0, $pos); $str = substr($content, $pos + 1); $pos = strpos($str, " "); $utodayviews = substr($str, 0, $pos); $str = substr($str, $pos + 1); $pos = strpos($str, " "); $allviews = substr($str, 0, $pos); $str = substr($str, $pos + 1); $pos = strpos($str, " "); $uallviews = substr($str, 0, $pos); $str = substr($str, $pos + 1); $pos = strpos($str, " "); if ($pos !== FALSE) { $old_d = substr($str, 0, $pos); $ips = substr($str, $pos + 1); if ($old_d != $d) { $todayviews = 1; $utodayviews = 1; $ips = ""; } else if (strpos($ips, $myip) !== FALSE) { ++$todayviews; ++$allviews; $unique = FALSE; } else { ++$todayviews; ++$utodayviews; ++$allviews; ++$uallviews; } } } } if (($ACT == "show") && ($INFO["exists"])) { if ($unique !== FALSE) { $ips.="\n".$myip; } $content = $todayviews." ".$utodayviews." ".$allviews." ".$uallviews." ".$d." ".$ips; file_put_contents($file, $content); } $fn.=" : Counter: ($todayviews / $utodayviews / $allviews / $uallviews $views_str) "; ?>
# diff -c ./template.php.orig ./template.php *** ./template.php.orig Sat Feb 7 14:15:51 2009 --- ./template.php Sat Feb 7 14:36:51 2009 *************** *** 945,950 **** --- 945,951 ---- // print it if($INFO['exists']){ + include("counter.php"); $out = ''; $out .= $fn; $out .= ' · ';
取りあえずこれだけで最小限のカウンターが、ページ最下部に表示されます。
このカウンターでは、ちっとも目立たないので、そこをどう修正するかが今後の検討課題ですね。