CGI サポートフォーラム

コメント返信ツリー表示一括表示リスト表示検索

質問をする前に、過去ログに同じ質問がないか検索してください。

Re:登録件数表示修正にバグがありました
投稿者:masaya さん  ( uid 21158, posts:2, since 2004/01/11 )
投稿日: 2004/01/11 (日) 01:42 No.365 | 編集 | 削除

記事No.363 へのコメントです。

>実は、No.338・れい様への返答にありました記事番号表示を当方でも導入しようとしたのですが、すべてのカテゴリを同時展開すると左フレームLINK MENUの表示がおかしいようです。

すみません。バグってました。
カテゴリごとの変数の初期化をし忘れていました。
以前の修正に$tmp_html=""; を追加する必要があります。

バグを直した修正をまとめておきます。

登録件数表示機能をつけるには、exit.cgiの68行目以降を以下のように変更してください。

sub menu {

&head;

my ($tmp_catid, $tmp_subid, $catdata, $subdata, $linkdata, $cat_linkcnt, $sub_linkcnt, $tmp_html);
my (%tmp_list, %tmp_sublist) = ();
my ($cat_max) = &LoadCategory;
my ($scat_max) = &LoadSubCategory;
&LoadLink;
$html .= "<img src=\"$imgdir/$menu_image\"><br>\n";
$html .= "<img src=\"$imgdir/line2.$ext\" width=150 height=5><br>\n";

@tmp_cat = split (/\:/, $in->{'catid'});
$tmp=0;

foreach $tmp_catid (keys %category) {
$catdata = &GetCategory ($tmp_catid);
$tmp_list{$catdata->{'group'}."_".$catdata->{'catname'}."_".$catid} = $tmp_catid;
}

foreach (sort keys %tmp_list) {
$catdata = &GetCategory ($tmp_list{$_});
$tmp_html="";
$tmp_count=0;
$cat_linkcnt=0;
foreach $tmp (@tmp_cat) {
if ($tmp eq $catdata->{'catid'}) {
$temp = $in->{'catid'};
$temp =~ s/:$tmp:/:/g;
$temp =~ s/^$tmp://;
$temp =~ s/:$tmp$//;
$tmp_count++;

foreach $tmp_subid (keys %subcategory) {
$subdata = &GetSubCategory ($tmp_subid);
$tmp_sublist{$subdata->{'group'}."_".$subdata->{'subname'}."_".$$tmp_subid} = $tmp_subid;
}
foreach (sort keys %tmp_sublist) {
$subdata = &GetSubCategory ($tmp_sublist{$_});
if ($subdata->{'catid'} eq $tmp) {
$sub_linkcnt = 0;
foreach $tmp_linkid (%link) {
$linkdata = &GetLink($tmp_linkid);
@tmp_sub = split (":", $linkdata->{'subid'});
foreach $tmp (@tmp_sub) {
if ($tmp eq $subdata->{'subid'}) { $sub_linkcnt++; $cat_linkcnt++;}
}
}
$tmp_html .= "<a href=\"$script?mode=vew&subid=$subdata->{'subid'}\" target=\"vew\" class=\"menusub\"><img src=\"$imgdir/$dot_image\" border=0> $subdata->{'subname'} [$sub_linkcnt]</a><br>
\n";
}
}

$html .= "<a href=\"$script?mode=menu&catid=$temp&\" target=\"menu\" class=\"menu\"><img src=\"$imgdir/$dot_open\" border=0> $catdata->{'catname'} [$cat_linkcnt]</a><br>\n";
$html .= $tmp_html;
$html .= "<img src=\"$imgdir/line2.$ext\" width=150 height=5><br>\n";
}
}

if ($tmp_count == 0) {
foreach (%subcategory) {
$subdata = &GetSubCategory ($_);
if ($subdata->{'catid'} eq $catdata->{'catid'}) {
foreach $tmp_linkid (%link) {
$linkdata = &GetLink($tmp_linkid);
@tmp_sub = split (":", $linkdata->{'subid'});
foreach $tmp (@tmp_sub) {
if ($tmp eq $subdata->{'subid'}) {$cat_linkcnt++;}
}
}
}
}
$temp = $in->{'catid'};
$temp .= ":$catdata->{'catid'}";
$html .= "<a href=\"$script?mode=menu&catid=$temp\" target=\"menu\" class=\"menu\"><img src=\"$imgdir/$dot_close\" border=0> $catdata->{'catname'} [$cat_linkcnt]</a><br>\n";
$html .= "<img src=\"$imgdir/line2.$ext\" width=150 height=5><br>\n";
}
}

$html .= <<_HTML_;

[ この記事にコメントを返信する ] [ 原文引用 ]

この記事に対するコメント返信

- TOP -

管理者:webmaster
NICOLE's - WWWForum 3.7c  Modified by masaya
Catch: Sat Apr 20 14:55:57 2024
[jcode.pl:679:warn] defined(%hash) is deprecated at lib/jcode.pl line 679.
[jcode.pl:679:warn] (Maybe you should just omit the defined()?)
[jcode.pl:688:warn] defined(%hash) is deprecated at lib/jcode.pl line 688.
[jcode.pl:688:warn] (Maybe you should just omit the defined()?)

/wwwforum/wwwforum.cgi?id=11&az=msg&number=365 with Perl 5.016003 for freebsd