アクセス ランキングが直った。 [MovableType]
先月、サイトをphp化しました。
そのおり、ついでに個別アーカイブ(Individual Entry Archive)のファイル名を
年年年年_月月日日_時時分分.php
に変えたんです。すると、アクセス ランキングを表示するプラグイン(Rambles In The Brambles: MT-MostVisited Plugin)が、このファイル名の記事をカウントしてくれません。(T_T)
そこで、以下の2点を変更。
■ 個別アーカイブのファイル名を
年年年年_月月日日_時時分分_EntryID.php
つまり<$MTArchiveDate format="%Y_%m%d_%H%M"$>_<$MTEntryID$>.php
に変えました。ファイル名に“EntryID”が無いとダメなの忘れてた。(^^ゞ
■ mt-mostvisited.plを、当サイトのディレクトリ設定およびファイル名・拡張子(“/archives/年年年年_月月日日_時時分分_EntryID.php”)にあわせて、以下のように書きかえました。
mt-mostvisited.pl 27行目あたり
...my $root = "/archives";
my $filetype = "php";
...
mt-mostvisited.pl 220行目あたり
...my $numfound = 0;
foreach (keys %files) {
# if (/^$root\/(\w+)\.$filetype$/) {
if (/^$root\/(\w+)_(\w+)_(\w+)_(\w+)\.$filetype$/) {
++$numfound;
my $count = 0;
# if (exists $archives{$1}) { $count = $archives{$1}; }
# $archives{$1} = $count + $files{$_};
if (exists $archives{$4}) { $count = $archives{$4}; }
$archives{$4} = $count + $files{$_};
}
}
return $numfound;
}
...
やれやれ、直った。^^;
参考記事は
blog:N@TURE BRAIN: MT-Visitedプラグイン導入
X *ole.net : ランキングが死んだかと思った。。。
です。ありがとうございました。

















