拙作プラグイン「CategoryCloud」の作成において各カテゴリ毎の記事数を取得したいのだけど、html化した個別記事では記事数が取得できない状況。
dumpしてみたらどうやら、 $var{'entryinfo'}{'category'} の {'category'} のキーが undef で定義されてない模様。
同じエントリの表示でも個別htmlとsb.cgiからeidで表示させるので違うのね。
例:$var{'entryinfo'} を dump で表示
・sb.cgi?eid=xxxで表示do { my $a = \{ category => { "0" => 167, 1 => 50, 2 => 14, 3 => 5, 4 => 12, 5 => 35, 6 => 17, 7 => 21, 8 => 9, 9 => 8, 10 => 1, 11 => 17, 12 => 6, 13 => 190, 14 => 13, 15 => 59, 16 => 122, 17 => 36, 18 => 6, 19 => 17, 20 => 3, 21 => 3, 22 => 51, 23 => 22, 24 => 7, 25 => 4, 26 => 55, 27 => 58, 28 => 10, 29 => 43, 30 => 38, 31 => 7, 32 => 1, 33 => 108, 34 => 3, 35 => 16, 36 => 7, 37 => 13, 38 => 11, 39 => 13, 40 => 12, 41 => 7, 42 => 1, 43 => 33, 44 => 21, 45 => 2, 46 => 34, 47 => 22, 48 => 5, 49 => 17, 50 => 5, 51 => 5, 52 => 5, 53 => 6, 54 => 11, 55 => 4, }, daily => { 20060801 => 7, 20060802 => 6, 20060803 => 9, 20060804 => 8, 20060805 => 1, 20060806 => 4, 20060807 => 6, 20060808 => 11, 20060809 => 6, 20060810 => 10, 20060811 => 5, 20060812 => 7, 20060813 => 1, 20060815 => 4, 20060816 => 9, 20060817 => 10, 20060818 => 10, 20060819 => 5, 20060820 => 3, 20060821 => 4, 20060822 => 6, 20060823 => 3, 20060824 => 13, 20060825 => 4, }, latest => [ bless({ add => undef, auth => 0, cat => 4, com => 0, content_list => [ "id", "wid", "subj", "cat", "date", "auth", "stat", "com", "tb", "file", "tz", "add", "edit", "acm", "atb", "form", "ping", "body", "more", "sum", "key", "ext", "tmp", ], date => "1156479454", file => "", id => 1133, "stat" => 1, subj => pack("H*","435353a5b9a5bfa5a4a5eba5aca5a4a5c9"), tb => 0, trash_can => 0, tz => "+0900", wid => 0, }, "sb::Data::Entry"), bless({ add => undef, auth => 0, cat => 43, com => 0, content_list => 'fix', date => "1156478297", file => "", id => 1132, "stat" => 1, subj => pack("H*","a5e9a5b9a5afbdf1b4caa4dea4c8a4e1"), tb => 0, trash_can => 0, tz => "+0900", wid => 0, }, "sb::Data::Entry"), bless({ add => undef, auth => 0, cat => 1, com => 0, content_list => 'fix', date => "1156472341", file => "", id => 1131, "stat" => 1, subj => pack("H*","b8c2b3a6a4cfa4c9a4cea4d8a4f3a4c0a4eda4a6"), tb => 0, trash_can => 0, tz => "+0900", wid => 0, }, "sb::Data::Entry"), bless({ add => ",1,2,", auth => 0, cat => 6, com => 0, content_list => 'fix', date => "1156470033", file => "", id => 1130, "stat" => 1, subj => "[sb2] CategoryCloud v1.00", tb => 0, trash_can => 0, tz => "+0900", wid => 0, }, "sb::Data::Entry"), bless({ add => ",13,", auth => 0, cat => 35, com => 0, content_list => 'fix', date => "1156425766", file => "", id => 1129, "stat" => 1, subj => pack("H*","a5bca5eda4cebbc8a4a4cbe220233820a5bfa5d0a5b5a4cec8ebcca9"), tb => 0, trash_can => 0, tz => "+0900", wid => 0, }, "sb::Data::Entry"), ], monthly => { 200410 => { count => 54, name => "October 2004" }, 200411 => { count => 37, name => "November 2004" }, 200412 => { count => 24, name => "December 2004" }, 200501 => { count => 32, name => "January 2005" }, 200502 => { count => 21, name => "February 2005" }, 200503 => { count => 28, name => "March 2005" }, 200504 => { count => 42, name => "April 2005" }, 200505 => { count => 20, name => "May 2005" }, 200506 => { count => 22, name => "June 2005" }, 200507 => { count => 27, name => "July 2005" }, 200508 => { count => 34, name => "August 2005" }, 200509 => { count => 27, name => "September 2005" }, 200510 => { count => 35, name => "October 2005" }, 200511 => { count => 24, name => "November 2005" }, 200512 => { count => 54, name => "December 2005" }, 200601 => { count => 64, name => "January 2006" }, 200602 => { count => 78, name => "February 2006" }, 200603 => { count => 47, name => "March 2006" }, 200604 => { count => 69, name => "April 2006" }, 200605 => { count => 39, name => "May 2006" }, 200606 => { count => 76, name => "June 2006" }, 200607 => { count => 118, name => "July 2006" }, 200608 => { count => 152, name => "August 2006" }, }, neighbor => { "next" => undef, prev => 'fix' }, }; $$a->{latest}[1]{content_list} = $$a->{latest}[0]{content_list}; $$a->{latest}[2]{content_list} = $$a->{latest}[0]{content_list}; $$a->{latest}[3]{content_list} = $$a->{latest}[0]{content_list}; $$a->{latest}[4]{content_list} = $$a->{latest}[0]{content_list}; $$a->{neighbor}{prev} = $$a->{latest}[1]; $a; }
・個別htmlでの表示do { require MIME::Base64; \{ neighbor => { "next" => undef, prev => bless({ acm => 1, add => "", atb => 1, auth => 0, body => MIME::Base64::decode("w93F58zkwuqkx6GipMikxqTita69xaTIu9ekpqXppbmlr73xtMqkzqTepMik4QoKPGEgaHJlZj0iaHR0cDovL2Jicy5lbmpveWtvcmVhLmpwL3RiYnMvcmVhZC5waHA/Ym9hcmRfaWQ9cGhpc3RvcnkmbmlkPTY5MDgyIiB0YXJnZXQ9Il9ibGFuayIgdGl0bGU9ImVuam95IEtvcmVhIj48c3Ryb25nPr7Xt+KhqsPdxeehysbIxeehy6TPpOSkw6TRpOrG/MvcpM7OzsXapMCkw6S/oarGqKSypOukyqGqt+ikt6TGxqiksqTrpMqhqqHKsLW+oaHLPC9zdHJvbmc+PC9hPgooZW5qb3kgS29yZWEp"), cat => 43, com => 0, content_list => [ "id", "wid", "subj", "cat", "date", "auth", "stat", "com", "tb", "file", "tz", "add", "edit", "acm", "atb", "form", "ping", "body", "more", "sum", "key", "ext", "tmp", ], date => "1156478297", edit => 0, ext => undef, file => "", form => 1, id => 1132, key => undef, more => undef, ping => "", "stat" => 1, subj => pack("H*","a5e9a5b9a5afbdf1b4caa4dea4c8a4e1"), sum => undef, tb => 0, tmp => undef, trash_can => 0, tz => "+0900", wid => 0, }, "sb::Data::Entry"), }, }; }
明らかに情報量が違うのだけど・・base64でエンコードされた中に隠されているのかね?
でも、標準のカテゴリリストでは html出力でもちゃんと記事数を取得できてるんだよなぁ。
で、標準のカテゴリリストの部分をテンプレートに出力するブロック名だけ変えてまるコピーしただけのプラグインを作って、html 出力してみたら・・
うわーん;;;
取得できないのはプラグインが呼び出されるタイミングなのかなぁ・・・;;
さて・・・どうしたらよかんべ。
追記:
標準のカテゴリリストは html ファイルに直接記述するのではなく、/log/cat.js を表示させてるだけみたい。
実装が違うのだから何か別の手を考えないとなぁ。
<<続きを隠す