1
_info?>FAQ
body<=
[Add to FAQ]\n";
}
my %faqcat;
my %faqq;
$sth = $dbh->prepare("SELECT faqcat, faqcatname, catorder FROM faqcat");
$sth->execute;
while ($_ = $sth->fetchrow_hashref)
{
$faqcat{$_->{'faqcat'}} = $_;
}
$sth = $dbh->prepare("SELECT faqid, question, sortorder, faqcat, lastmodtime FROM faq");
$sth->execute;
while ($_ = $sth->fetchrow_hashref)
{
$faqq{$_->{'faqcat'}}->{$_->{'faqid'}} = $_;
}
foreach my $faqcat (sort { $faqcat{$a}->{'catorder'} <=> $faqcat{$b}->{'catorder'} } keys %faqcat)
{
$ret .= "
\n";
$ret .= "\n";
foreach my $faqid (sort { $faqq{$faqcat}->{$a}->{'sortorder'} <=> $faqq{$faqcat}->{$b}->{'sortorder'} } keys %{$faqq{$faqcat}})
{
my $fe = $faqq{$faqcat}->{$faqid};
next unless ($fe->{'question'});
my $q = LJ::ehtml($fe->{'question'});
$q =~ s/^\s+//; $q =~ s/\s+$//;
$q =~ s/\n/
/g;
$ret .= "- ";
if ($ac_edit{'*'} || $ac_edit{$faqcat}) {
$ret .= "[edit] ($fe->{'sortorder'}) ";
}
$ret .= "{$faqid} $q\n";
}
$ret .= "
\n";
}
return $ret;
_code?>
<=body
page?>
lib: cgi-bin/ljlib.pl
link: htdocs/admin/faq/readcat.bml, htdocs/admin/faq/faqedit.bml
_c?>